Hiya all,
I was trying to get and_raise to raise an exception filled with a message and I
was struggling with the API for a while (not on the latest RSpec, but assume it
didn't change).
Based on that, I have a suggestion for improvement. My first attempt was to
mirror how I use raise, so I tried:
subject.should_receive(:do_system).and_raise(Osaka::SystemCommandFailed,
"execution error: System Events got an error: Access for assistive devices is
disabled. (-25211)")
This didn't work as the and_raise only has one parameter. Eventually I figured
out this works:
subject.should_receive(:do_system).and_raise(Osaka::SystemCommandFailed.new
("execution error: System Events got an error: Access for assistive devices is
disabled. (-25211)"))
And it does what I want it to do. Still… I would have prefered the first one to
work too :) Implementing that ought to be reasonably trivial, correct?
(didn't implement it myself yet this time).
Comments? Or is there anyone way of doing this?
Thanks!
Bas
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users