aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/kernel/warn_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/kernel/warn_spec.rb')
-rw-r--r--spec/ruby/core/kernel/warn_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/kernel/warn_spec.rb b/spec/ruby/core/kernel/warn_spec.rb
index 7a0c431ff0..0b461ec25a 100644
--- a/spec/ruby/core/kernel/warn_spec.rb
+++ b/spec/ruby/core/kernel/warn_spec.rb
@@ -77,6 +77,15 @@ describe "Kernel#warn" do
}.should output(nil, /\n/)
end
+ it "writes to_s representation if passed a non-string" do
+ obj = mock("obj")
+ obj.should_receive(:to_s).and_return("to_s called")
+ lambda {
+ $VERBOSE = true
+ warn(obj)
+ }.should output(nil, "to_s called\n")
+ end
+
ruby_version_is "2.5" do
describe ":uplevel keyword argument" do
before :each do