Module: Remarkable
- Extended by:
- I18n
- Defined in:
- lib/remarkable/matchers.rb,
lib/remarkable/dsl.rb,
lib/remarkable/base.rb,
lib/remarkable/i18n.rb,
lib/remarkable/macros.rb,
lib/remarkable/pending.rb,
lib/remarkable/version.rb,
lib/remarkable/messages.rb,
lib/remarkable/negative.rb,
lib/remarkable/dsl/callbacks.rb,
lib/remarkable/dsl/optionals.rb,
lib/remarkable/core_ext/array.rb,
lib/remarkable/dsl/assertions.rb
Overview
:nodoc:
Defined Under Namespace
Modules: CoreExt, DSL, I18n, Macros, Matchers, Messages, Negative, Pending Classes: Base
Constant Summary collapse
- VERSION =
'3.1.13'
Class Method Summary collapse
-
.include_matchers!(base, target = nil) ⇒ Object
Helper that includes required Remarkable modules into the given klass.
-
.rspec_defined? ⇒ Boolean
:nodoc:.
Methods included from I18n
add_locale, locale, locale=, localize, translate
Class Method Details
.include_matchers!(base, target = nil) ⇒ Object
Helper that includes required Remarkable modules into the given klass.
If the module to be included responds to :after_include, it’s called with the target as argument.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/remarkable/matchers.rb', line 12 def self.include_matchers!(base, target=nil) if target.nil? if rspec_defined? target = Spec::Example::ExampleGroup else raise ArgumentError, "You haven't supplied the target to include_matchers! and RSpec is not loaded, so we cannot infer one." end end = (class << target; self; end) target.send :extend, Remarkable::Pending unless .ancestors.include?(Remarkable::Pending) target.send :extend, Remarkable::Macros unless .ancestors.include?(Remarkable::Macros) if defined?(base::Matchers) target.send :include, base::Matchers Remarkable::Matchers.send :extend, base::Matchers Remarkable::Matchers.send :include, base::Matchers end if base.respond_to?(:after_include) base.after_include(target) end end |
.rspec_defined? ⇒ Boolean
:nodoc:
37 38 39 |
# File 'lib/remarkable/matchers.rb', line 37 def self.rspec_defined? #:nodoc: defined?(Spec) end |