mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@ec84479
This commit is contained in:
parent
296f68816c
commit
f234d51eab
50 changed files with 739 additions and 377 deletions
|
@ -69,6 +69,23 @@ describe "Date#parse" do
|
|||
-> { Date.parse(1) }.should raise_error(TypeError)
|
||||
-> { Date.parse(:invalid) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "coerces using to_str" do
|
||||
c = Class.new do
|
||||
attr_accessor :string
|
||||
def to_str
|
||||
@string
|
||||
end
|
||||
end
|
||||
o = c.new
|
||||
o.string = "19101101"
|
||||
|
||||
d = Date.parse(o)
|
||||
d.should == Date.civil(1910, 11, 1)
|
||||
|
||||
# parse should not modify string value
|
||||
o.to_str.should == "19101101"
|
||||
end
|
||||
end
|
||||
|
||||
describe "Date#parse with '.' separator" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue