Created
January 24, 2012 20:57
-
-
Save jasonroelofs/1672565 to your computer and use it in GitHub Desktop.
Why write two lines of code when you can write 30!
This file contains hidden or 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
class Clock | |
def self.now | |
Time.now | |
end | |
def self.today | |
Date.today | |
end | |
end |
This file contains hidden or 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
require 'spec_helper' | |
describe Clock do | |
describe ".now" do | |
it 'returns the current time' do | |
Clock.now.should be_close(Time.now, 0.01) | |
end | |
end | |
describe ".todqy" do | |
it 'returns Date.today' do | |
Clock.today.should == Date.today | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment