diff options
Diffstat (limited to 'spec/ruby/core/kernel/print_spec.rb')
| -rw-r--r-- | spec/ruby/core/kernel/print_spec.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/ruby/core/kernel/print_spec.rb b/spec/ruby/core/kernel/print_spec.rb index 3b642538cb..5473d22f71 100644 --- a/spec/ruby/core/kernel/print_spec.rb +++ b/spec/ruby/core/kernel/print_spec.rb @@ -1,9 +1,21 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../fixtures/classes', __FILE__) +require_relative '../../spec_helper' +require_relative 'fixtures/classes' describe "Kernel#print" do it "is a private method" do - Kernel.should have_private_instance_method(:print) + Kernel.private_instance_methods(false).should.include?(:print) + end + + it "delegates to $stdout" do + -> { print :arg }.should output("arg") + end + + it "prints $_ when no arguments are given" do + orig_value = $_ + $_ = 'foo' + -> { print }.should output("foo") + ensure + $_ = orig_value end end |
