Skip to content

Instantly share code, notes, and snippets.

@biot023
Created January 20, 2011 14:20
Show Gist options
  • Save biot023/787941 to your computer and use it in GitHub Desktop.
Save biot023/787941 to your computer and use it in GitHub Desktop.
describe "Something" do
before( :each ) do
Kernel.stub!( :rand ).and_return( 0 )
end
def do_call
MyObject.do_something
end
it "should generate a random number between 0 and 1" do
Kernel.should_receive( :rand ).with( 2 ).and_return( 0 )
do_call
end
context "when the random number is 0" do
it "should be specced"
end
context "when the random number is 1" do
before( :each ) do
Kernel.stub!( :rand ).and_return( 0 )
end
it "should be specced"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment