On Mon, Aug 29, 2011 at 9:24 AM, Ash Moran <[email protected]> wrote:
> it "prints an error" do
> ignoring_errors {
> run_command(%w[ missing_wallet.dat ])
> }
> stream_bundle.captured_error.should eq "Couldn't find wallet file:
> missing_wallet.dat\n"
> end
>
> Now obviously that wouldn't be hard to add as a helper method. But it got me
> thinking…
>
> * Do any of you do this?
I do. So often that I wrote a helper and put it in Wrong.
I don't quite get what "stream_bundle.captured_error" is in your
example, but I think the above example would become
rescuing {
run_command(%w[ missing_wallet.dat ])
}.message.should == "Couldn't find whatever"
We've also got "capturing" for grabbing console output, e.g.
capturing { puts "hi" }.should == "hi"
or
out, err = capturing(:stdout, :stderr) { ... }
See https://github.com/sconover/wrong
--
Alex Chaffee - [email protected]
http://alexch.github.com
http://twitter.com/alexch
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users