diff options
Diffstat (limited to 'spec/ruby/core/kernel/throw_spec.rb')
| -rw-r--r-- | spec/ruby/core/kernel/throw_spec.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/ruby/core/kernel/throw_spec.rb b/spec/ruby/core/kernel/throw_spec.rb index 1e56376529..1086126176 100644 --- a/spec/ruby/core/kernel/throw_spec.rb +++ b/spec/ruby/core/kernel/throw_spec.rb @@ -7,7 +7,7 @@ describe "Kernel.throw" do :value throw :blah fail("throw didn't transfer the control") - end.should be_nil + end.should == nil end it "transfers control to the innermost catch block waiting for the same symbol" do @@ -42,39 +42,39 @@ describe "Kernel.throw" do end it "raises an ArgumentError if there is no catch block for the symbol" do - lambda { throw :blah }.should raise_error(ArgumentError) + -> { throw :blah }.should.raise(ArgumentError) end it "raises an UncaughtThrowError if there is no catch block for the symbol" do - lambda { throw :blah }.should raise_error(UncaughtThrowError) + -> { throw :blah }.should.raise(UncaughtThrowError) end it "raises ArgumentError if 3 or more arguments provided" do - lambda { + -> { catch :blah do throw :blah, :return_value, 2 end - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) - lambda { + -> { catch :blah do throw :blah, :return_value, 2, 3, 4, 5 end - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end it "can throw an object" do - lambda { + -> { obj = Object.new catch obj do throw obj end - }.should_not raise_error(NameError) + }.should_not.raise(NameError) end end describe "Kernel#throw" do it "is a private method" do - Kernel.should have_private_instance_method(:throw) + Kernel.private_instance_methods(false).should.include?(:throw) end end |
