spec/awesome_date_spec.rb in lantus-0.0.1 vs spec/awesome_date_spec.rb in lantus-0.0.2
- old
+ new
@@ -1,51 +1,57 @@
-require 'lantus'
+require 'spec_helper'
-describe Lantus::AwesomeDate do
- otd = Lantus::AwesomeDate.new "Jun 22 2012 9:00:12 AM"
+module Lantus
+ describe AwesomeDate, "initialized with 'Jun 22 2012 9:00:12 AM'" do
+ before :each do
+ @awesome_date = AwesomeDate.new "Jun 22 2012 9:00:12 AM"
+ end
- it "should have the correct timestamp" do
- otd["timestamp"].to_s.should == "2012-06-22 09:00:12 +0100"
- end
+ describe "time" do
+ it "should be '09:00:12 BST'" do
+ @awesome_date.time.should == "09:00:12 BST"
+ end
+ end
- it "should have the correct time" do
- otd["time"].should == "09:00:12 BST"
- end
+ describe "short time" do
+ it "should be '09:00'" do
+ @awesome_date.short_time.should == "09:00"
+ end
+ end
- it "should have the correct date" do
- otd["date"].should == "2012-06-22"
- end
+ describe "date" do
+ it "should be '2012-06-22'" do
+ @awesome_date.date.should == "2012-06-22"
+ end
+ end
- it "should have the correct day" do
- otd["day"].should == "friday"
- end
+ describe "day" do
+ it "should be 'friday'" do
+ @awesome_date.day.should == "friday"
+ end
+ end
- it "should have the correct month" do
- otd["month"].should == "june"
- end
+ describe "cardinal day" do
+ it "should be 22" do
+ @awesome_date.cardinal_day.should == 22
+ end
+ end
- it "should have the correct cardinal day" do
- otd["cardinal_day"].should == 22
- end
+ describe "ordinal day" do
+ it "should be '22nd'" do
+ @awesome_date.ordinal_day.should == "22nd"
+ end
+ end
- it "should have the correct ordinal day" do
- otd["ordinal_day"].should == "22nd"
- end
+ describe "month" do
+ it "should be 'june'" do
+ @awesome_date.month.should == "june"
+ end
+ end
- it "should have the correct nice_date" do
- otd["nice_date"].should == "friday june 22nd"
- end
-
- it "should have the correct short time" do
- otd["short_time"].should == "09:00"
- end
-
- otd_gmt = Lantus::AwesomeDate.new "Jan 22 2012 9:00:12 PM"
-
- it "should have the correct timestamp" do
- otd_gmt["timestamp"].to_s.should == "2012-01-22 21:00:12 +0000"
- end
-
- it "should have the correct time and TZ" do
- otd_gmt["time"].should == "21:00:12 GMT"
+ describe "nice date" do
+ it "should be 'friday june 22nd'" do
+ @awesome_date.nice_date.should == "friday june 22nd"
+ end
+ end
end
end