Class: RSpec::Matchers::BuiltIn::YieldSuccessiveArgs
- Inherits:
-
Object
- Object
- RSpec::Matchers::BuiltIn::YieldSuccessiveArgs
- Defined in:
- lib/rspec/matchers/built_in/yield.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(*args) ⇒ YieldSuccessiveArgs
constructor
A new instance of YieldSuccessiveArgs.
- #matches?(block) ⇒ Boolean (also: #==)
Constructor Details
#initialize(*args) ⇒ YieldSuccessiveArgs
Returns a new instance of YieldSuccessiveArgs.
179 180 181 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 179 def initialize(*args) @expected = args end |
Instance Method Details
#description ⇒ Object
202 203 204 205 206 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 202 def description desc = "yield successive args" desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" desc end |
#failure_message_for_should ⇒ Object
190 191 192 193 194 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 190 def "expected given block to yield successively with arguments, but yielded with unexpected arguments" + "\nexpected: #{@expected.inspect}" + "\n got: #{@actual.inspect} (compared using === and ==)" end |
#failure_message_for_should_not ⇒ Object
196 197 198 199 200 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 196 def "expected given block not to yield successively with arguments, but yielded with expected arguments" + "\nexpected not: #{@expected.inspect}" + "\n got: #{@actual.inspect} (compared using === and ==)" end |
#matches?(block) ⇒ Boolean Also known as: ==
183 184 185 186 187 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 183 def matches?(block) @probe = YieldProbe.probe(block) @actual = @probe.successive_yield_args args_match? end |