Skip to content

Commit 9d34580

Browse files
committed
Add spec for Symbol#to_proc#inspect
1 parent efd67a7 commit 9d34580

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

spec/ruby/core/proc/shared/to_s.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,24 @@
3232
describe "for a proc created with UnboundMethod#to_proc" do
3333
it "returns a description including '(lambda)' and optionally including file and line number" do
3434
def hello; end
35-
3635
method("hello").to_proc.send(@method).should =~ /^#<Proc:([^ ]*?)(@([^ ]*)\/to_s\.rb:22)? \(lambda\)>$/
3736
end
3837

3938
it "has an ASCII-8BIT encoding" do
4039
def hello; end
41-
4240
method("hello").to_proc.send(@method).encoding.should == Encoding::ASCII_8BIT
4341
end
4442
end
43+
44+
describe "for a proc created with Symbol#to_proc" do
45+
it "returns a description including '(&:symbol)'" do
46+
proc = :foobar.to_proc
47+
proc.send(@method).should =~ /^#<Proc:0x\h+\(&:foobar\)>$/
48+
end
49+
50+
it "has an ASCII-8BIT encoding" do
51+
proc = :foobar.to_proc
52+
proc.send(@method).encoding.should == Encoding::ASCII_8BIT
53+
end
54+
end
4555
end

0 commit comments

Comments
 (0)