Created
April 12, 2012 16:31
-
-
Save mrnugget/2368895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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