Using the "have_failed" matcher with flexmock invokes an RSpec warning. For example, the following spec:
require 'rspec/given'
require 'flexmock/rspec/configure'
class Dog
def initialize(tail)
@tail = tail
end
def happy
end
end
describe Dog do
Given(:tail) { flexmock() }
Given(:fido) { Dog.new(tail) }
When { fido.happy }
Then { tail.should have_received(:wag).once }
end
gives the following output:
F
Failures:
1) Dog should When you call a matcher in an example without a String, like this:
specify { object.should matcher }
or this:
it { should matcher }
RSpec expects the matcher to have a #description method. You should either
add a String to the example this matcher is being used in, or give it a
description method. Then you won't have to suffer this lengthy warning again.
Failure/Error: Then { tail.should have_received(:wag).once }
expected wag(...) to be received by <FlexMock:unknown> once.
No messages have been received
# /Users/jim/pgm/ruby/testexample/missing_description_spec.rb:16:in `block (2 levels) in <top (required)>'
# /Users/jim/pgm/ruby/testexample/missing_description_spec.rb:16:in `block in Then'
Finished in 0.00042 seconds
1 example, 1 failure
Using the "have_failed" matcher with flexmock invokes an RSpec warning. For example, the following spec:
gives the following output: