Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DEPRECATION WARNING: TimeWithZone#to_s(:short) #528

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iainbeeston
Copy link

Rails has deprecated passing a parameter to to_s and
now expects to_formatted_s to be used instead.

This is the full error I see:

DEPRECATION WARNING: TimeWithZone#to_s(:short) is deprecated. Please use TimeWithZone#to_fs(:short) instead. (called from to_s at /ice-cube-ruby/ice_cube/lib/ice_cube/occurrence.rb:89)

Rails has deprecated passing a parameter to `to_s` and
now expects `to_formatted_s` to be used instead.

This is the full error I see:

    DEPRECATION WARNING: TimeWithZone#to_s(:short) is deprecated. Please use TimeWithZone#to_fs(:short) instead. (called from to_s at /ice-cube-ruby/ice_cube/lib/ice_cube/occurrence.rb:89)
@adfoster-r7
Copy link

Looks like this is now an error in newer versions of Active Support:

Failures:

  1) IceCube::Occurrence to_s accepts a format option to comply with ActiveSupport
     Failure/Error: expect(occurrence.to_s(:short)).to eq time_now.to_s(:short)
     
     ArgumentError:
       wrong number of arguments (given 1, expected 0)
     # /Users/user/.rvm/gems/ruby-3.0.2@pro/gems/activesupport-7.1.3/lib/active_support/time_with_zone.rb:200:in `to_s'
     # ./spec/examples/occurrence_spec.rb:31:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:76:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:75:in `block (2 levels) in <top (required)>'

After applying these changes locally, they pass though 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants