1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -71,11 +71,11 @@ describe "Time.at" do
describe "passed non-Time, non-Numeric" do
it "raises a TypeError with a String argument" do
lambda { Time.at("0") }.should raise_error(TypeError)
-> { Time.at("0") }.should raise_error(TypeError)
end
it "raises a TypeError with a nil argument" do
lambda { Time.at(nil) }.should raise_error(TypeError)
-> { Time.at(nil) }.should raise_error(TypeError)
end
describe "with an argument that responds to #to_int" do
@ -127,20 +127,20 @@ describe "Time.at" do
describe "passed [Integer, nil]" do
it "raises a TypeError" do
lambda { Time.at(0, nil) }.should raise_error(TypeError)
-> { Time.at(0, nil) }.should raise_error(TypeError)
end
end
describe "passed [Integer, String]" do
it "raises a TypeError" do
lambda { Time.at(0, "0") }.should raise_error(TypeError)
-> { Time.at(0, "0") }.should raise_error(TypeError)
end
end
describe "passed [Time, Integer]" do
# #8173
it "raises a TypeError" do
lambda { Time.at(Time.now, 500000) }.should raise_error(TypeError)
-> { Time.at(Time.now, 500000) }.should raise_error(TypeError)
end
end
@ -178,15 +178,15 @@ describe "Time.at" do
context "not supported format" do
it "raises ArgumentError" do
->() { Time.at(0, 123456, 2) }.should raise_error(ArgumentError)
->() { Time.at(0, 123456, nil) }.should raise_error(ArgumentError)
->() { Time.at(0, 123456, :invalid) }.should raise_error(ArgumentError)
-> { Time.at(0, 123456, 2) }.should raise_error(ArgumentError)
-> { Time.at(0, 123456, nil) }.should raise_error(ArgumentError)
-> { Time.at(0, 123456, :invalid) }.should raise_error(ArgumentError)
end
it "does not try to convert format to Symbol with #to_sym" do
format = "usec"
format.should_not_receive(:to_sym)
-> () { Time.at(0, 123456, format) }.should raise_error(ArgumentError)
-> { Time.at(0, 123456, format) }.should raise_error(ArgumentError)
end
end