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

v3 fails in Ruby 2.4 and earlier #36

Closed
cyclotron3k opened this issue Apr 14, 2020 · 0 comments
Closed

v3 fails in Ruby 2.4 and earlier #36

cyclotron3k opened this issue Apr 14, 2020 · 0 comments

Comments

@cyclotron3k
Copy link

cyclotron3k commented Apr 14, 2020

Describe the bug
Can't use v3.x.x in Ruby <= 2.4.

Struct has been used in Pushover since version 3. The keyword_init: true argument is being used, and this isn't available in Ruby 2.4 or earlier.

To Reproduce
Run unit tests in Ruby 2.4 & 2.3, etc.
The unit tests will fail:

An error occurred while loading ./spec/pushover/response_spec.rb.
Failure/Error:
    Message = Struct.new(:token, :user, :message, :attachment, :device, :title, :url, :url_title, :priority, :sound, :timestamp, :expire, :retry, :callback, keyword_init: true) do
      # push the configured message to pushover.
      #   @return [Response] response for the receipt request
      def push
        %i[token user message].each { |param| raise "#{param} must be supplied" unless send param }
  
        Response.create_from_excon_response Excon.post(path: '1/messages.json', query: to_h)
      end
    end

TypeError:
  {:keyword_init=>true} is not a symbol
# ./lib/pushover/message.rb:29:in `new'
# ./lib/pushover/message.rb:29:in `<module:Pushover>'
# ./lib/pushover/message.rb:1:in `<top (required)>'
# ./lib/pushover.rb:4:in `<top (required)>'
# ./spec/spec_helper.rb:17:in `<top (required)>'
# ./spec/pushover/response_spec.rb:1:in `<top (required)>'

Ruby 2.4 (and earlier) are EOL. So fixing the issue is one option, but just adding a Ruby version constraint to the gemspec is another option. e.g. spec.required_ruby_version = '~> 2.5'.

I'm happy to make a PR for either option.

Can I also suggest adding multiple ruby versions to the TravisCI tests?

@cyclotron3k cyclotron3k closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
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

No branches or pull requests

1 participant