[rspec-users] default to just call the method?

Ashley Moran ashley.moran at patchspace.co.uk
Thu Jan 14 10:32:48 EST 2010


On Jan 12, 2010, at 10:49 pm, rogerdpack wrote:

> a.should include?("1:4") # if there's no matcher called include? then
> just call include?

Am I right thinking that this would mean writing a method_missing that creates a matcher for every unhandled message on the example object (whatever scope the #it block runs in)?  If so, that could produce surprising behaviour if methods were silently turned into matchers and ignored.

Maybe if you restricted it to ? methods it would not be so bad.  But then, that's the point of the be_* handler.  The only problem is that #include? is a verb not an adjective/noun.  Can't say I've come across many of them, so it might be better in these cases to just write a method #a_container_for? ?

Ashley

-- 
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran



More information about the rspec-users mailing list