summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/kernel/raise.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/shared/kernel/raise.rb')
-rw-r--r--spec/ruby/shared/kernel/raise.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/ruby/shared/kernel/raise.rb b/spec/ruby/shared/kernel/raise.rb
index 4128a636ad..3cff55ac6e 100644
--- a/spec/ruby/shared/kernel/raise.rb
+++ b/spec/ruby/shared/kernel/raise.rb
@@ -44,11 +44,11 @@ describe :kernel_raise, shared: true do
it "re-raises the previously rescued exception if no exception is specified" do
lambda do
begin
- raise Exception, "outer"
+ @object.raise Exception, "outer"
ScratchPad.record :no_abort
rescue
begin
- raise StandardError, "inner"
+ @object.raise StandardError, "inner"
rescue
end
@@ -62,16 +62,17 @@ describe :kernel_raise, shared: true do
it "re-raises a previously rescued exception without overwriting the backtrace" do
begin
- raise 'raised'
+ initial_raise_line = __LINE__; @object.raise 'raised'
rescue => raised
begin
- raise_again_line = __LINE__; raise raised
+ raise_again_line = __LINE__; @object.raise raised
rescue => raised_again
# This spec is written using #backtrace and matching the line number
# from the string, as backtrace_locations is a more advanced
# method that is not always supported by implementations.
- raised_again.backtrace.first.should_not include(":#{raise_again_line}:")
+ raised_again.backtrace.first.should include("#{__FILE__}:#{initial_raise_line}:")
+ raised_again.backtrace.first.should_not include("#{__FILE__}:#{raise_again_line}:")
end
end
end