summaryrefslogtreecommitdiff
path: root/spec/ruby/language/throw_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/throw_spec.rb')
-rw-r--r--spec/ruby/language/throw_spec.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/ruby/language/throw_spec.rb b/spec/ruby/language/throw_spec.rb
index 92f699350c..73f64de17d 100644
--- a/spec/ruby/language/throw_spec.rb
+++ b/spec/ruby/language/throw_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require_relative '../spec_helper'
describe "The throw keyword" do
it "abandons processing" do
@@ -35,7 +35,7 @@ describe "The throw keyword" do
throw :exit
end
end
- $!.should be_nil
+ $!.should == nil
end
it "allows any object as its argument" do
@@ -45,7 +45,7 @@ describe "The throw keyword" do
end
it "does not convert strings to a symbol" do
- lambda { catch(:exit) { throw "exit" } }.should raise_error(ArgumentError)
+ -> { catch(:exit) { throw "exit" } }.should.raise(ArgumentError)
end
it "unwinds stack from within a method" do
@@ -59,13 +59,13 @@ describe "The throw keyword" do
end
it "unwinds stack from within a lambda" do
- c = lambda { throw :foo, :msg }
+ c = -> { throw :foo, :msg }
catch(:foo) { c.call }.should == :msg
end
it "raises an ArgumentError if outside of scope of a matching catch" do
- lambda { throw :test, 5 }.should raise_error(ArgumentError)
- lambda { catch(:different) { throw :test, 5 } }.should raise_error(ArgumentError)
+ -> { throw :test, 5 }.should.raise(ArgumentError)
+ -> { catch(:different) { throw :test, 5 } }.should.raise(ArgumentError)
end
it "raises an UncaughtThrowError if used to exit a thread" do
@@ -73,7 +73,7 @@ describe "The throw keyword" do
t = Thread.new {
-> {
throw :what
- }.should raise_error(UncaughtThrowError)
+ }.should.raise(UncaughtThrowError)
}
t.join
end