On Apr 9, 2012, at 2:41 PM, Matt Hauck wrote: > Is there a way to specify a message expectation on an object to occur > _without_ a particular argument? > > There is a particular function, which in some special circumstance takes a > unique argument, but in normal circumstances does not take this unique > argument. I want to say something like this: > > it "should recognize the special state" do > obj.set_special_state true > obj.should_receive(:my_method).with(/special_state/) > obj.my_method > end > it "should operate fine without the special state" do > obj.set_special_state false > obj.should_receive(:my_method).without(/special_state/) > obj.my_method > end > > This does not appear to be possible to set a "non-expectation" on an argument > matcher. Is there a way to do this? Or am I just going about this the wrong > way? > _______________________________________________ > rspec-users mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/rspec-users
Sorry for the late reply. This is what you want: http://rubydoc.info/gems/rspec-mocks/RSpec/Mocks/ArgumentMatchers:no_args -- You received this message because you are subscribed to the Google Groups "rspec" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rspec?hl=en.
