Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created March 20, 2010 16:56
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 dchelimsky/338767 to your computer and use it in GitHub Desktop.
Save dchelimsky/338767 to your computer and use it in GitHub Desktop.
describe Person do
context "walking on a rainy day" do
context "with an umbrella" do
it "stays dry" do
day = Day.new(:weather => Rain.new)
person = Person.new(:umbrella => Umbrella.new)
person.walk_on(day)
person.should be_dry
end
end
context "without an umbrella" do
it "gets wet" do
day = Day.new(:weather => Rain.new)
person = Person.new(:umbrella => nil)
person.walk_on(day)
person.should be_dry
end
end
end
end
describe Person do
context "walking on a rainy day" do
let(:rainy_day) { Day.new(:weather => Rain.new }
context "with an umbrella" do
it "stays dry" do
person = Person.new(:umbrella => Umbrella.new)
person.walk_on(rainy_day)
person.should be_dry
end
end
context "without an umbrella" do
it "gets wet" do
person = Person.new(:umbrella => nil)
person.walk_on(rainy_day)
person.should be_dry
end
end
end
end
describe Person do
before(:each) do
@person = Person.new
end
context "walking on a rainy day" do
before(:each) do
@day = Day.new(:weather => Rain.new)
end
context "with an umbrella" do
before(:each) do
@person.umbrella = Umbrella.new
end
it "stays dry" do
@person.walk_on(@day)
@person.should be_dry
end
end
context "without an umbrella" do
before(:each) do
@person.umbrella = nil
end
it "gets wet" do
@person.walk_on(@day)
@person.should be_dry
end
end
end
end
describe Person do
before(:each) do
@person = Person.new
end
context "with an umbrella" do
before(:each) do
@person.umbrella = Umbrella.new
end
context "walking on a rainy day" do
before(:each) do
@day = Day.new(:weather => Rain.new)
@person.walk_on(@day)
end
it "stays dry" do
@person.should be_dry
end
end
end
context "with an umbrella" do
before(:each) do
@person.umbrella = nil
end
context "walking on a rainy day" do
before(:each) do
@day = Day.new(:weather => Rain.new)
@person.walk_on(@day)
end
it "gets wet" do
@person.should be_dry
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment