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

Commit 0ff6358

Browse files
richardplatelJonRowe
authored andcommitted
Use __send__ instead of send
1 parent 8158970 commit 0ff6358

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/rspec/core/output_wrapper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ def respond_to?(name, priv=false)
1515
end
1616

1717
def method_missing(name, *args, &block)
18-
output.send(name, *args, &block)
18+
output.__send__(name, *args, &block)
1919
end
2020

2121
# Redirect calls for IO interface methods
2222
IO.instance_methods(false).each do |method|
2323
define_method(method) do |*args, &block|
24-
output.send(method, *args, &block)
24+
output.__send__(method, *args, &block)
2525
end
2626
end
2727
end

spec/rspec/core/output_wrapper_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ module RSpec::Core
99
expect(output.string).to eq("message\nanother message").and eq(wrapper.string)
1010
end
1111

12+
it 'redirects calls when send is overridden' do
13+
class << output
14+
undef :send
15+
end
16+
wrapper.puts('message')
17+
expect(output.string).to eq("message\n").and eq(wrapper.string)
18+
end
19+
1220
describe '#output=' do
1321
let(:another_output) { StringIO.new }
1422

0 commit comments

Comments
 (0)