Skip to content

Instantly share code, notes, and snippets.

@cyx
Created March 1, 2010 02:31
Show Gist options
  • Save cyx/318028 to your computer and use it in GitHub Desktop.
Save cyx/318028 to your computer and use it in GitHub Desktop.
describe "given today is April fools" do
before(:each) { Timecop.freeze Time.utc( 2010, 04, 01 ) }
describe Item, "bought yesterday" do
subject { Item.new(:when => 'Yesterday') }
its(:when) { should == Date.new( 2010, 03, 31 ) }
end
describe Item, "bought today" do
subject { Item.new(:when => 'Today') }
its(:when) { should == Date.new( 2010, 04, 01 ) }
end
describe Item, "bought last friday" do
subject { Item.new(:when => "Last friday") }
its(:when) { should == Date.new(2010, 03, 26) }
end
describe Item, "bought this friday" do
subject { Item.new(:when => "this friday") }
its(:when) { should == Date.new(2010, 04, 02) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment