Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Guard undefs and use an object that implements :=~ in all Ruby versions for specs #526

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions spec/rspec/support_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def foo
http_request_class = Struct.new(:method, :uri)

proxy_class = Struct.new(:original) do
undef :=~, :method
undef :=~ if respond_to?(:=~)
undef :method if respond_to?(:method)
def method_missing(name, *args, &block)
original.__send__(name, *args, &block)
end
Expand All @@ -39,12 +40,12 @@ def method_missing(name, *args, &block)
end

it 'fetches method definitions for proxy objects' do
object = proxy_class.new([])
object = proxy_class.new('abc')
expect(Support.method_handle_for(object, :=~)).to be_a Method
end

it 'fetches method definitions for proxy objects' do
object = proxy_class.new([])
object = proxy_class.new('abc')
expect(Support.method_handle_for(object, :=~)).to be_a Method
end

Expand Down