Module: Spec::Matchers
- Defined in:
- lib/merb-core/test/test_ext/rspec.rb,
lib/merb-core/test/test_ext/rspec.rb
Defined Under Namespace
Classes: MatcherDSL
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create(*names, &block) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/merb-core/test/test_ext/rspec.rb', line 85 def self.create(*names, &block) @guid ||= 0 Merb::Test::Matchers.module_eval do klass = Class.new(MatcherDSL) do def initialize(expected_value) @expected_value = expected_value end end klass.class_eval(&block) names.each do |name| define_method(name) do |*expected_value| # Avoid a warning for the form should foo. klass.new(expected_value && expected_value[0]) end end end end |