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

Test failures with Ruby 3 #135

Closed
snecklifter opened this issue Feb 1, 2021 · 5 comments
Closed

Test failures with Ruby 3 #135

snecklifter opened this issue Feb 1, 2021 · 5 comments

Comments

@snecklifter
Copy link

I think this is related to the bump to Ruby 3.0 but when running tests in Fedora I see:

rspec ./spec/integration_spec.rb[1:4:16] # Integration test sample file rendering renders the gradient_transform.svg sample file without warnings or crashing
rspec ./spec/integration_spec.rb[1:4:17] # Integration test sample file rendering renders the gradients.svg sample file without warnings or crashing
rspec ./spec/integration_spec.rb[1:4:41] # Integration test sample file rendering renders the radgrad01-bounding.svg sample file without warnings or crashing
rspec ./spec/integration_spec.rb[1:4:42] # Integration test sample file rendering renders the radgrad01.svg sample file without warnings or crashing

One example error is:

 1) Integration test sample file rendering renders the gradient_transform.svg sample file without warnings or crashing
     Failure/Error: prawn.send(call, *arguments)

     ArgumentError:
       Unknown type of gradient: [{:from=>[0.0, 257.14285714285717], :to=>[200.0, 57.14285714285717], :stops=>[[0.0, "00008b"], [0.5, "87ceeb"], [1.0, "00008b"]], :apply_transformations=>true}]
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/graphics/patterns.rb:126:in `parse_gradient_arguments'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/graphics/patterns.rb:82:in `set_gradient'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/graphics/patterns.rb:70:in `fill_gradient'
     # ./lib/prawn/svg/interface.rb:123:in `block in issue_prawn_command'
     # ./lib/prawn/svg/interface.rb:112:in `each'
     # ./lib/prawn/svg/interface.rb:112:in `issue_prawn_command'
     # ./lib/prawn/svg/interface.rb:108:in `block in proc_creator'
     # ./lib/prawn/svg/interface.rb:51:in `block (3 levels) in draw'
     # /usr/share/gems/gems/pdf-core-0.9.0/lib/pdf/core/renderer.rb:245:in `save_graphics_state'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/document/internals.rb:33:in `save_graphics_state'
     # ./lib/prawn/svg/interface.rb:44:in `block (2 levels) in draw'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/document/bounding_box.rb:200:in `init_bounding_box'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/document/bounding_box.rb:159:in `bounding_box'
     # ./lib/prawn/svg/interface.rb:43:in `block in draw'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/font.rb:214:in `save_font'
     # ./lib/prawn/svg/interface.rb:42:in `draw'
     # ./lib/prawn/svg/extension.rb:19:in `svg'
     # ./spec/integration_spec.rb:107:in `block (5 levels) in <top (required)>'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/document.rb:239:in `initialize'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/document.rb:145:in `new'
     # /usr/share/gems/gems/prawn-2.4.0/lib/prawn/document.rb:145:in `generate'
     # ./spec/integration_spec.rb:106:in `block (4 levels) in <top (required)>'

Any ideas on how to resolve this appreciated.

@mojavelinux
Copy link
Contributor

mojavelinux commented Feb 1, 2021

You are indeed correct. I reported it in Prawn because I'm not sure if the issue is in Prawn or in Prawn SVG. prawnpdf/prawn#1196

@mtasaka
Copy link

mtasaka commented Feb 3, 2021

Note that with ruby 2.7, running with env RUBYOPT="-W:deprecated" already warns:

/dir/prawn-svg-0.31.0/lib/prawn/svg/interface.rb:123: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/usr/share/gems/gems/prawn-2.3.0/lib/prawn/graphics/patterns.rb:69: warning: The called method `fill_gradient' is defined here
/dir/prawn-svg-0.31.0/lib/prawn/svg/interface.rb:123: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/usr/share/gems/gems/prawn-2.3.0/lib/prawn/graphics/patterns.rb:75: warning: The called method `stroke_gradient' is defined here

@mtasaka
Copy link

mtasaka commented Feb 3, 2021

Perhaps this is due to ruby 3.0 keyword separation (I see many project now suffers from this change...) https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

@mtasaka
Copy link

mtasaka commented Feb 3, 2021

So I've not checked in detail but #133 is needed for ruby 3.0 ( #133 may need reviewing or fixing, but something like the PR is needed )

@mogest
Copy link
Owner

mogest commented Mar 8, 2021

Fixed in #133.

@mogest mogest closed this as completed Mar 8, 2021
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

4 participants