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

Proxy doesn't support keyworad argument of Ruby 3.0 #77

Closed
ashie opened this issue Mar 30, 2021 · 2 comments
Closed

Proxy doesn't support keyworad argument of Ruby 3.0 #77

ashie opened this issue Mar 30, 2021 · 2 comments

Comments

@ashie
Copy link

ashie commented Mar 30, 2021

Example test code

require 'test/unit/rr'

class Klass
  def write(txt, silent: true)
    puts(txt) unless silent
  end
end

class TestKlass < Test::Unit::TestCase
  test "write" do
    c = Klass.new
    mock.proxy(c).write("write", silent: false).once
    c.write("write", silent: false)
  end
end

Result on Ruby 2.6.6

$ rbenv local 2.6.6
$ ruby -w -I"lib:test" test_proxy.rb
Loaded suite test_proxy
Started
write
.
Finished in 0.000560186 seconds.
---------------------------------------------------------------------------------------------------------------------------------------------
1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
---------------------------------------------------------------------------------------------------------------------------------------------
1785.12 tests/s, 0.00 assertions/s

Result on Ruby 3.0.0

$ rbenv local 3.0.0
$ ruby -w -I"lib:test" test_proxy.rb
Loaded suite test_proxy
Started
E
=============================================================================================================================================
test_proxy.rb:13:in `block in <class:TestKlass>'
/home/aho/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rr-1.2.1/lib/rr/injections/double_injection.rb:148:in `write'
/home/aho/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rr-1.2.1/lib/rr/injections/double_injection.rb:40:in `dispatch_method'
/home/aho/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rr-1.2.1/lib/rr/injections/double_injection.rb:183:in `dispatch_method'
/home/aho/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rr-1.2.1/lib/rr/method_dispatches/method_dispatch.rb:16:in `call'
/home/aho/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rr-1.2.1/lib/rr/method_dispatches/method_dispatch.rb:41:in `call_implementation'
/home/aho/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rr-1.2.1/lib/rr/method_dispatches/method_dispatch.rb:30:in `call_original_method'
test_proxy.rb:4:in `write'
Error: test: write(TestKlass): ArgumentError: wrong number of arguments (given 2, expected 1)
=============================================================================================================================================

Finished in 0.001129911 seconds.
---------------------------------------------------------------------------------------------------------------------------------------------
1 tests, 0 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
---------------------------------------------------------------------------------------------------------------------------------------------
885.03 tests/s, 0.00 assertions/s
@kou kou closed this as completed in d6da209 Mar 30, 2021
@kou
Copy link
Member

kou commented Mar 31, 2021

I've released RR 3.0.0 that supports Ruby 3.0.

@ashie
Copy link
Author

ashie commented Mar 31, 2021

Thanks!

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

2 participants