Skip to content

Commit 7ef881a

Browse files
committed
Add spec for NoMethodError from dstr to_s calls
See jruby#9222
1 parent 17e333f commit 7ef881a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

spec/ruby/language/string_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ class << obj
133133
"#{obj}".should == '42'
134134
end
135135

136+
it "raise NoMethodError when #to_s is not defined for the object" do
137+
obj = BasicObject.new
138+
139+
-> { "#{obj}" }.should raise_error(NoMethodError)
140+
end
141+
136142
it "uses an internal representation when #to_s doesn't return a String" do
137143
obj = mock('to_s')
138144
obj.stub!(:to_s).and_return(42)

0 commit comments

Comments
 (0)