Skip to content

Instantly share code, notes, and snippets.

@mrnugget
Created April 12, 2012 16:31
Show Gist options
  • Save mrnugget/2368895 to your computer and use it in GitHub Desktop.
Save mrnugget/2368895 to your computer and use it in GitHub Desktop.
describe "includes Publishable" do
before(:each) do
@now = DateTime.now
DateTime.stub!(:now).and_return(@now)
end
it "accepts '1' or 1 as valid arguments and sets published_at to a DateTime object" do
NewsItem.new(published_at: '1').published_at.should_not be_nil
NewsItem.new(published_at: 1).published_at.should == @now
end
it "accepts '0' or 0 as valid arguments and sets published_at to nil" do
NewsItem.new(published_at: '0').published_at.should be_nil
NewsItem.new(published_at: 0).published_at.should be_nil
end
it "accepts a DateTime argument" do
NewsItem.new(published_at: @now).published_at.should == @now
end
en
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment