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

Patch to support ruby 3.0 #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Patch to support ruby 3.0 #20

wants to merge 3 commits into from

Conversation

dleidert
Copy link

These patches have been written by Mamoru TASAKA of the Fedora project:

https://src.fedoraproject.org/rpms/rubygem-flexmock/tree/rawhide

They fix various issues with Ruby 3.0.

Fixes the warning:

    warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
Fixes

```
  1) Failure:
TestStubbing#test_partial_mocks_leaves_NoMethodError_exceptions_raised_by_the_original_method_unchanged [/build/ruby-flexmock-2XiXfY/ruby-flexmock-2.3.6/test/partial_mock_test.rb:625]:
--- expected
+++ actual
@@ -1 +1,3 @@
-"undefined method `does_not_exist' for #<#<Class:0xXXXXXX>:0xXXXXXX>"
+# encoding: US-ASCII
+#    valid: true
+"undefined method `does_not_exist' for #<#<Class:0xXXXXXX>:0xXXXXXX @flexmock_proxy=#<FlexMock::PartialMockProxy::ProxyBox:0xXXXXXX @stack=[#<struct FlexMock::PartialMockProxy::ProxyBox::Element proxy=nil, container=nil>, #<struct FlexMock::PartialMockProxy::ProxyBox::Element proxy=#<FlexMock::PartialMockProxy:0xXXXXXX @obj=#<#<Class:0xXXXXXX>:0xXXXXXX ...>, @mock=<FlexMock:flexmock(#<Class:0xXXXXXX>)>, @proxy_definition_module=#<Module:0xXXXXXX>, @initialize_override=nil, @method_definitions={:mocked_method=>#<UnboundMethod: #<Class:0xXXXXXX>#mocked_method() /build/ruby-flexmock-2XiXfY/ruby-flexmock-2.3.6/test/partial_mock_test.rb:619>}>, container=#<TestStubbing:0xXXXXXX @name=\"test_partial_mocks_leaves_NoMethodError_exceptions_raised_by_the_original_method_unchanged\", @failures=[], @assertions=1, @flexmock_worker=#<FlexMock::MockBuilder:0xXXXXXX @container=#<TestStubbing:0xXXXXXX ...>>, @flexmock_created_mocks=[<FlexMock:flexmock(#<Class:0xXXXXXX>)>, #<FlexMock::PartialMockProxy:0xXXXXXX @obj=#<#<Class:0xXXXXXX>:0xXXXXXX ...>, @mock=<FlexMock:flexmock(#<Class:0xXXXXXX>)>, @proxy_definition_module=#<Module:0xXXXXXX>, @initialize_override=nil, @method_definitions={:mocked_method=>#<UnboundMethod: #<Class:0xXXXXXX>#mocked_method() /build/ruby-flexmock-2XiXfY/ruby-flexmock-2.3.6/test/partial_mock_test.rb:619>}>]>>]>>"
```
@doudou
Copy link
Owner

doudou commented Nov 22, 2021

Hi @dleidert. Thanks for the contribution !

I'll have to work on the second commit (binding.source_location), which won't work on ruby 2.5 (and I need that one)

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.

None yet

2 participants