Reputation: 2794
Is there any way i can test a generic executable using rspec? I like the way tests are defined in rspec.
Something along the lines of
it "should return error" do
program.output.should == "Error in program"
end
Upvotes: 2
Views: 395
Reputation: 41
Rspec 3.0 output matcher:
expect { its_my_mthd }.to output("its the message for the world").to_stdout
expect { its_my_mthd }.to output("its devils message error").to_stderr
Minitest also has something called capture_io:
out, err = capture_io do
my_method
end
assert_equals "its the message for the world", out
assert_equals "its devils message error", err
Upvotes: 2