summaryrefslogtreecommitdiff
path: root/spec/ruby/core/kernel/p_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/kernel/p_spec.rb')
-rw-r--r--spec/ruby/core/kernel/p_spec.rb34
1 files changed, 18 insertions, 16 deletions
diff --git a/spec/ruby/core/kernel/p_spec.rb b/spec/ruby/core/kernel/p_spec.rb
index 1221465243..f89716899a 100644
--- a/spec/ruby/core/kernel/p_spec.rb
+++ b/spec/ruby/core/kernel/p_spec.rb
@@ -13,7 +13,7 @@ describe "Kernel#p" do
end
it "is a private method" do
- Kernel.should have_private_instance_method(:p)
+ Kernel.private_instance_methods(false).should.include?(:p)
end
# TODO: fix
@@ -42,10 +42,10 @@ describe "Kernel#p" do
o = mock("Inspector Gadget")
o.should_receive(:inspect).any_number_of_times.and_return "Next time, Gadget, NEXT TIME!"
- lambda { p(o) }.should output("Next time, Gadget, NEXT TIME!\n")
- lambda { p(*[o]) }.should output("Next time, Gadget, NEXT TIME!\n")
- lambda { p(*[o, o]) }.should output("Next time, Gadget, NEXT TIME!\nNext time, Gadget, NEXT TIME!\n")
- lambda { p([o])}.should output("[#{o.inspect}]\n")
+ -> { p(o) }.should output("Next time, Gadget, NEXT TIME!\n")
+ -> { p(*[o]) }.should output("Next time, Gadget, NEXT TIME!\n")
+ -> { p(*[o, o]) }.should output("Next time, Gadget, NEXT TIME!\nNext time, Gadget, NEXT TIME!\n")
+ -> { p([o])}.should output("[#{o.inspect}]\n")
end
it "is not affected by setting $\\, $/ or $," do
@@ -55,27 +55,29 @@ describe "Kernel#p" do
suppress_warning {
$, = " *helicopter sound*\n"
}
- lambda { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
+ -> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
- $\ = " *helicopter sound*\n"
- lambda { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
+ suppress_warning {
+ $\ = " *helicopter sound*\n"
+ }
+ -> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
- $/ = " *helicopter sound*\n"
- lambda { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
+ suppress_warning {
+ $/ = " *helicopter sound*\n"
+ }
+ -> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
end
it "prints nothing if no argument is given" do
- lambda { p }.should output("")
+ -> { p }.should output("")
end
it "prints nothing if called splatting an empty Array" do
- lambda { p(*[]) }.should output("")
+ -> { p(*[]) }.should output("")
end
-=begin Not sure how to spec this, but wanted to note the behavior here
- it "does not flush if receiver is not a TTY or a File" do
- end
-=end
+ # Not sure how to spec this, but wanted to note the behavior here
+ it "does not flush if receiver is not a TTY or a File"
end
describe "Kernel.p" do