On 10/4/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > > On Oct 4, 2007, at 12:46 PM, Nick Sieger wrote: > > > On 10/4/07, Eric Pugh <[EMAIL PROTECTED]> wrote: > >> Hi all, > >> > >> I have an array of shipping_type's being returned, and I want to see > >> what is in there. In the past I have done: > >> > >> shipping_type.include?(Cart::SHIPPING_TYPE_REGULAR).should > >> be_true > >> > >> This works, but looks really ugly.. It just doesn't roll of the > >> tongue very well. I then looked up the use of Predicates, which I > >> had been using, but hadn't realized: > >> > >> shipping_type.should be_include(Cart::SHIPPING_TYPE_REGULAR) > > > > You were close on this one, it should just be > > > > shipping_type.should include(Cart::SHIPPING_TYPE_REGULAR) > > > > It's a special predicate just for working with arrays. > > Isn't it a general predicate for all foo? (boolean) methods? > > class Object > def foo? > true > end > end > > Object.new.should be_foo > > Doesn't that work, as well?
Sure it does, but be_include sounds icky. That's the point of this thread, I believe. > > Scott > > > > _______________________________________________ > rspec-users mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
