Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 4a61665

Browse files
committed
Rename safely to make it more clear what it’s for.
1 parent f98223d commit 4a61665

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

spec/rspec/core/backtrace_formatter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def make_backtrace_formatter(exclusion_patterns=nil, inclusion_patterns=nil)
206206
end
207207

208208
it "deals gracefully with a security error" do
209-
safely do
209+
with_safe_set_to_level_that_triggers_security_errors do
210210
self.formatter.__send__(:backtrace_line, __FILE__)
211211
# on some rubies, this doesn't raise a SecurityError; this test just
212212
# assures that if it *does* raise an error, the error is caught inside

spec/rspec/core/formatters/snippet_extractor_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Formatters
1414

1515
it "falls back on a default message when it gets a security error" do
1616
message = nil
17-
safely do
17+
with_safe_set_to_level_that_triggers_security_errors do
1818
message = RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8)
1919
end
2020
expect(message).to eq("# Couldn't get snippet for blech")

spec/rspec/core/metadata_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Core
1515
end
1616
# I have no idea what line = line.sub(/\A([^:]+:\d+)$/, '\\1') is supposed to do
1717
it "gracefully returns nil if run in a secure thread" do
18-
safely do
18+
with_safe_set_to_level_that_triggers_security_errors do
1919
value = Metadata.relative_path(".")
2020
# on some rubies, File.expand_path is not a security error, so accept "." as well
2121
expect([nil, "."]).to include(value)

spec/rspec/core/notifications_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
let(:exception) { instance_double(Exception, :backtrace => [ "#{__FILE__}:#{__LINE__}"]) }
3434

3535
it "is handled gracefully" do
36-
safely do
36+
with_safe_set_to_level_that_triggers_security_errors do
3737
expect { notification.send(:read_failed_line) }.not_to raise_error
3838
end
3939
end

spec/support/helper_methods.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def ignoring_warnings
1111
result
1212
end
1313

14-
def safely
14+
def with_safe_set_to_level_that_triggers_security_errors
1515
Thread.new do
1616
ignoring_warnings { $SAFE = 3 }
1717
yield

0 commit comments

Comments
 (0)