[rspec-users] expecting one of two conditions

2013-03-09 Thread Fearless Fool
I'm expecting my_test to raise one error or another, but since I'm pulling data from a db, I don't know which error it will be. Is there a better way to write this? expect { my_test }.to raise_error { |error| error.should satisfy {|e| e.instance_of?(OneError) || e.instance_of?(OtherError)

Re: [rspec-users] expecting one of two conditions

2013-03-09 Thread Adam Sroka
It depends on what you really mean: 1) If you care that it is either OneError or OtherError, then these are two separate scenarios and should be written as such. 2) If you don't care which one it is, then you probably just be less specific. Is there a common message they respond to that you

Re: [rspec-users] expecting one of two conditions

2013-03-09 Thread Robert Poor
On Sat, Mar 9, 2013 at 4:24 PM, Adam Sroka adam.sr...@gmail.com wrote: It depends on what you really mean: 1) If you care that it is either OneError or OtherError, then these are two separate scenarios and should be written as such. 2) If you don't care which one it is, then you probably

Re: [rspec-users] expecting one of two conditions

2013-03-09 Thread Samer Masry
It would be better to split that into two tests that test when each error is raised. On Mar 9, 2013, at 4:24 PM, Adam Sroka adam.sr...@gmail.com wrote: It depends on what you really mean: 1) If you care that it is either OneError or OtherError, then these are two separate scenarios and

Re: [rspec-users] expecting one of two conditions

2013-03-09 Thread Robert Poor
On Sat, Mar 9, 2013 at 6:08 PM, Samer Masry samer.ma...@gmail.com wrote: It would be better to split that into two tests that test when each error is raised. Except that the specific error that I receive depends on the ordering of the data in the database, which isn't something I control.