Skip to content

Instantly share code, notes, and snippets.

@melissalouie
Created November 19, 2013 20:03
Show Gist options
  • Save melissalouie/7551607 to your computer and use it in GitHub Desktop.
Save melissalouie/7551607 to your computer and use it in GitHub Desktop.
describe Cookie do
let(:cookie) { Cookie.new(type, bake_time)}
let(:type) { "chocolate chip"}
let(:bake_time) { 20 }
context "#initialize" do
it "creates an instance of cookie" do
cookie.should be_an_instance_of Cookie
end
it "requires two parameters" do
expect { Cookie.new }.to raise_error(ArgumentError)
end
end
context "#baked?" do
it "should be baked when time in over is greater than or equal to 20" do
20.times do
cookie.increment_time_in_oven
end
cookie.should be_baked
end
it "should not be baked when time is less than 20" do
10.times do
cookie.increment_time_in_oven
end
cookie.should_not be_baked
end
it "should be burnt when time is more than 20" do
22.times do
cookie.increment_time_in_oven
end
cookie.should be_burned
end
end
context "#remove_from_oven" do
it "should be out of the oven when removed from oven" do
cookie.remove_from_oven
cookie.in_oven.should be_false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment