Re: [rspec-users] Best way to match several attributes of an object?

2010-04-08 Thread Mikel Lindsaar
>> When you need to check several properties of an object, what is the >> best way to match them all? In the mail library I use a custom matcher, which lets me do things like: it "should handle |Minero Aoki |" do address = Mail::Address.new('Minero Aoki ') address.should break_down_to({

Re: [rspec-users] Best way to match several attributes of an object?

2010-03-31 Thread Pat Maddox
On Mar 30, 2010, at 7:23 AM, George wrote: > When you need to check several properties of an object, what is the > best way to match them all? > > I'm using the 'satisfy' matcher at the moment but perhaps there's a > better way than this: > flight.should satisfy { |f| >f.booking_code

Re: [rspec-users] Best way to match several attributes of an object?

2010-03-30 Thread George
Yep, that's a fair point and may improve readability if I set up the compare object in a before method. Good idea, thanks David. George On Mar 30, 5:43 pm, David Chelimsky wrote: > On Mar 30, 2010, at 9:23 AM, George wrote: > > > > > When you need to check several properties of an object, what is

Re: [rspec-users] Best way to match several attributes of an object?

2010-03-30 Thread David Chelimsky
On Mar 30, 2010, at 9:23 AM, George wrote: > When you need to check several properties of an object, what is the > best way to match them all? > > I'm using the 'satisfy' matcher at the moment but perhaps there's a > better way than this: > flight.should satisfy { |f| >f.booking_code

[rspec-users] Best way to match several attributes of an object?

2010-03-30 Thread George
When you need to check several properties of an object, what is the best way to match them all? I'm using the 'satisfy' matcher at the moment but perhaps there's a better way than this: flight.should satisfy { |f| f.booking_code== @parsed_pnr_data[:pnr_number] &&