ruby / spec

The Ruby Spec Suite aka ruby/spec
MIT License
588 stars 384 forks source link

Where should `Time#to_date` and `Time#to_datetime` be? #1146

Closed nobu closed 3 months ago

nobu commented 3 months ago

Currently, "specs" of these methods are placed under ruby/library/time. But these are defined by the "date" library, which just extends Time. It doesn't look the right place.

eregon commented 3 months ago

How about library/date/time/to_date_spec.rb / library/date/time/to_datetime_spec.rb ? That seems consistent with e.g. https://github.com/ruby/spec/tree/master/library/prime/integer. Could you commit that here or in ruby/ruby? (whatever is more convenient for you)

nobu commented 3 months ago

How about library/date/time/to_date_spec.rb / library/date/time/to_datetime_spec.rb ?

Isn't the latter library/datetime/time/to_datetime_spec.rb?

eregon commented 3 months ago

Isn't the latter library/datetime/time/to_datetime_spec.rb?

No, because there is no require 'datetime'. library/X means the library which can be required with require 'X'

eregon commented 3 months ago

Ah but there is already library/datetime, so an existing issue, so fine as you did.

eregon commented 3 months ago

Probably we should have library/date/{date,datetime,time}, but I'm not sure how much it matters.