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

2013-03-10 Thread Robert Poor
On Sun, Mar 10, 2013 at 7:59 AM, Matt Wynne wrote: > Could you give both errors a common base class, then assert on that? > That's the winning solution. Thanks! ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listin

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

2013-03-10 Thread Matt Wynne
On 10 Mar 2013, at 02:04, Robert Poor wrote: > On Sat, Mar 9, 2013 at 4:24 PM, Adam Sroka 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

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 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. Hmm -- as I stare at

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 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

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 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 just be less > sp

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 could

[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)