Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added specs to check Time.to_s format
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
require File.dirname(__FILE__) + '/../../spec_helper' | ||
require File.dirname(__FILE__) + '/fixtures/methods' | ||
require File.dirname(__FILE__) + '/shared/inspect' | ||
|
||
describe "Time.inspect" do | ||
it_behaves_like :inspect, :inspect | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe :inspect, :shared => true do | ||
ruby_version_is ""..."1.9" do | ||
it "formats the time following the pattern 'EEE MMM dd HH:mm:ss Z yyyy'" do | ||
with_timezone("PST", +1) do | ||
Time.local("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "Sat Jan 01 20:15:01 +0100 2000" | ||
end | ||
end | ||
|
||
it "formats the UTC time following the pattern 'EEE MMM dd HH:mm:ss UTC yyyy'" do | ||
Time.utc("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "Sat Jan 01 20:15:01 UTC 2000" | ||
end | ||
end | ||
|
||
ruby_version_is "1.9" do | ||
it "formats the time following the pattern 'yyyy-MM-DD dd HH:mm:ss Z'" do | ||
with_timezone("PST", +1) do | ||
Time.local("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "2000-01-01 20:15:01 +0100" | ||
end | ||
end | ||
|
||
it "formats the UTC time following the pattern 'yyyy-MM-DD HH:mm:ss UTC'" do | ||
Time.utc("1", "15", "20", "1", "1", "2000", :ignored, :ignored, :ignored, :ignored).send(@method).should == "2000-01-01 20:15:01 UTC" | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
require File.dirname(__FILE__) + '/../../spec_helper' | ||
require File.dirname(__FILE__) + '/fixtures/methods' | ||
require File.dirname(__FILE__) + '/shared/inspect' | ||
|
||
describe "Time.to_s" do | ||
it_behaves_like :inspect, :to_s | ||
end |