Skip to content

Instantly share code, notes, and snippets.

@deepj
Created July 20, 2009 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepj/150220 to your computer and use it in GitHub Desktop.
Save deepj/150220 to your computer and use it in GitHub Desktop.
# 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