Created
July 20, 2009 09:21
-
-
Save deepj/150220 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
# encoding: utf-8 | |
require File.dirname(__FILE__) + '/../../spec_helper' | |
Rango.import("ext/time_dsl") | |
SECOND = 1 | |
TWO_SECONDS = 2 * SECOND | |
MINUTE = 60 * SECOND | |
TWO_MINUTES = 2 * MINUTE | |
HOUR = 60 * MINUTE | |
TWO_HOURS = 2 * HOUR | |
DAY = 24 * HOUR | |
TWO_DAYS = 2 * DAY | |
WEEK = 7 * DAY | |
TWO_WEEKS = 2 * WEEK | |
MONTH = 30 * DAY | |
TWO_MONTHS = 2 * MONTH | |
YEAR = 365 * DAY + 6 * HOUR | |
TWO_YEARS = 2 * YEAR | |
describe TimeDSL do | |
it "should return correct count of seconds for 1.second" do | |
1.second.should eql SECOND | |
end | |
it "should return correct count of seconds for 2.seconds" do | |
2.seconds.should eql TWO_SECONDS | |
end | |
it "should return correct count of seconds for 1.minute" do | |
1.minute.should eql MINUTE | |
end | |
it "should return correct count of seconds for 2.minutes" do | |
2.minutes.should eql TWO_MINUTES | |
end | |
it "should return correct count of seconds for 1.hour" do | |
1.hour.should eql HOUR | |
end | |
it "should return correct count of seconds for 2.hours" do | |
2.hours.should eql TWO_HOURS | |
end | |
it "should return correct count of seconds for 1.day" do | |
1.day.should eql DAY | |
end | |
it "should return correct count of seconds for 2.day" do | |
2.day.should eql TWO_DAYS | |
end | |
it "should return correct count of seconds for 1.week" do | |
1.week.should eql WEEK | |
end | |
it "should return correct count of seconds for 2.weeks" do | |
2.weeks.should eql TWO_WEEKS | |
end | |
it "should return correct count of seconds for 1.month" do | |
1.month.should eql MONTH | |
end | |
it "should return correct count of seconds for 2.months" do | |
2.months.should eql TWO_MONTHS | |
end | |
it "should return correct count of seconds for 1.year" do | |
1.year.should eql YEAR | |
end | |
it "should return correct count of seconds for 2.years" do | |
2.years.should eql TWO_YEARS | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment