Skip to content

Commit 5680ac1

Browse files
committed
Add spec that #public_send is included in the backtrace if passed incorrect arguments
1 parent 0c01508 commit 5680ac1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/ruby/core/kernel/public_send_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,13 @@ def bar
104104
}.should raise_error(NoMethodError)
105105
end
106106

107+
it "includes `public_send` in the backtrace when passed not enough arguments" do
108+
-> { public_send() }.should raise_error(ArgumentError) { |e| e.backtrace[0].should.include?("`public_send'") }
109+
end
110+
111+
it "includes `public_send` in the backtrace when passed a single incorrect argument" do
112+
-> { public_send(Object.new) }.should raise_error(TypeError) { |e| e.backtrace[0].should.include?("`public_send'") }
113+
end
114+
107115
it_behaves_like :basicobject_send, :public_send
108116
end

0 commit comments

Comments
 (0)