Skip to content

Commit 117a8d2

Browse files
committed
Use __send__ rather than send to prevent collisions
1 parent 70e57a1 commit 117a8d2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/rspec/rails/adapters.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ module ClassMethods
102102
def setup(*methods)
103103
methods.each do |method|
104104
if method.to_s =~ /^setup_(fixtures|controller_request_and_response)$/
105-
prepend_before { send method }
105+
prepend_before { __send__ method }
106106
else
107-
before { send method }
107+
before { __send__ method }
108108
end
109109
end
110110
end
@@ -114,7 +114,7 @@ def setup(*methods)
114114
# Wraps `teardown` calls from within Rails' testing framework in
115115
# `after` hooks.
116116
def teardown(*methods)
117-
methods.each { |method| after { send method } }
117+
methods.each { |method| after { __send__ method } }
118118
end
119119
end
120120

spec/rspec/rails/minitest_lifecycle_adapter_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,13 @@
1919
:before_setup, :after_setup, :example, :before_teardown, :after_teardown
2020
])
2121
end
22+
23+
it "allows let variables named 'send'" do
24+
run_result = ::RSpec::Core::ExampleGroup.describe do
25+
let(:send) { "WHAT" }
26+
specify { expect(send).to eq "WHAT" }
27+
end.run NullObject.new
28+
29+
expect(run_result).to be true
30+
end
2231
end

0 commit comments

Comments
 (0)