Skip to content

Instantly share code, notes, and snippets.

@rubyredrick
Forked from mattwynne/Suggestion #1.rb
Created January 30, 2009 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubyredrick/55165 to your computer and use it in GitHub Desktop.
Save rubyredrick/55165 to your computer and use it in GitHub Desktop.
it 'should do something' do
on_failure warn_that "@foo shouldn't be nil" do
@foo.should_not be_nil
end
end
it 'should do something' do
explain_that "@foo shouldn't be nil" unless
@foo.should_not be_nil
end
end
it 'should do something' do
on_failure do
@foo.should_not be_nil
end.report "this message"
end
it 'should do something' do
lambda do
@foo.should_not be_nil
end.on_error "this message"
end
it 'should do something' do
@foo.should_not be_nil(:because => "we like our foos, we do")
end
describe "calculator" do
it "should add two numbers together" do
expect_that "2 + 3 = 5" do
Calculator.new.add(2,3).should == 5
end
end
end
# if the expectation failed then the message would be 'expected 2 + 3 == 5, but got 6'
# perhaps this could be altered/extended with a way to insert the actual result with something like...
describe "calculator" do
it "should add two numbers together" do
expect_that "2 + 3 = 5 but we got $ACTUAL" do
Calculator.new.add(2,3).should == 5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment