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

Commit f27f6a1

Browse files
authored
Merge pull request #2437 from pat/frozen-string-literals
Updates for frozen-string-literal compatibility.
2 parents 2676226 + 9ed3359 commit f27f6a1

File tree

11 files changed

+20
-15
lines changed

11 files changed

+20
-15
lines changed

features/configuration/pattern.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Feature: pattern
4545
Given a file named "spec/spec_helper.rb" with:
4646
"""ruby
4747
RSpec.configure do |config|
48-
config.pattern << ',**/*.spec'
48+
config.pattern += ',**/*.spec'
4949
end
5050
"""
5151
And a file named "spec/two_examples.spec" with:

lib/rspec/core/drb.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def add_full_description(argv)
8484
def add_filter(argv, name, hash)
8585
hash.each_pair do |k, v|
8686
next if CONDITIONAL_FILTERS.include?(k)
87-
tag = name == :inclusion ? k.to_s : "~#{k}"
87+
tag = name == :inclusion ? k.to_s : "~#{k}".dup
8888
tag << ":#{v}" if v.is_a?(String)
8989
argv << "--tag" << tag
9090
end unless hash.empty?

lib/rspec/core/example.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ def mocks_need_verification?
523523
def assign_generated_description
524524
if metadata[:description].empty? && (description = generate_description)
525525
metadata[:description] = description
526-
metadata[:full_description] << description
526+
metadata[:full_description] += description
527527
end
528528
ensure
529529
RSpec::Matchers.clear_generated_description

lib/rspec/core/example_group.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def self.remove_all_constants
838838
end
839839

840840
def self.base_name_for(group)
841-
return "Anonymous" if group.description.empty?
841+
return "Anonymous".dup if group.description.empty?
842842

843843
# Convert to CamelCase.
844844
name = ' ' + group.description

lib/rspec/core/notifications.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def fully_formatted_failed_examples(colorizer=::RSpec::Core::Formatters::Console
120120
# @return [String] The list of pending examples, fully formatted in the
121121
# way that RSpec's built-in formatters emit.
122122
def fully_formatted_pending_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
123-
formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n"
123+
formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n".dup
124124

125125
pending_notifications.each_with_index do |notification, index|
126126
formatted << notification.fully_formatted(index.next, colorizer)
@@ -232,9 +232,14 @@ class SkippedExampleNotification < ExampleNotification
232232
# RSpec's built-in formatters emit.
233233
def fully_formatted(pending_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
234234
formatted_caller = RSpec.configuration.backtrace_formatter.backtrace_line(example.location)
235-
colorizer.wrap("\n #{pending_number}) #{example.full_description}", :pending) << "\n " <<
236-
Formatters::ExceptionPresenter::PENDING_DETAIL_FORMATTER.call(example, colorizer) <<
237-
"\n" << colorizer.wrap(" # #{formatted_caller}\n", :detail)
235+
236+
[
237+
colorizer.wrap("\n #{pending_number}) #{example.full_description}", :pending),
238+
"\n ",
239+
Formatters::ExceptionPresenter::PENDING_DETAIL_FORMATTER.call(example, colorizer),
240+
"\n",
241+
colorizer.wrap(" # #{formatted_caller}\n", :detail)
242+
].join("")
238243
end
239244
end
240245

rspec-core.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
4141
s.add_development_dependency "minitest", "~> 5.3"
4242
s.add_development_dependency "aruba", "~> 0.6.2" # 0.7 is broken on ruby 1.8.7
4343

44-
s.add_development_dependency "coderay", "~> 1.0.9"
44+
s.add_development_dependency "coderay", "~> 1.1.1"
4545

4646
s.add_development_dependency "mocha", "~> 0.13.0"
4747
s.add_development_dependency "rr", "~> 1.0.4"

spec/rspec/core/formatters/base_text_formatter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def run_all_and_dump_failures
190190
if String.method_defined?(:encoding)
191191
context "with an exception that has a differently encoded message" do
192192
it "runs without encountering an encoding exception" do
193-
group.example("Mixing encodings, e.g. UTF-8: © and Binary") { raise "Error: \xC2\xA9".force_encoding("ASCII-8BIT") }
193+
group.example("Mixing encodings, e.g. UTF-8: © and Binary") { raise "Error: \xC2\xA9".dup.force_encoding("ASCII-8BIT") }
194194
run_all_and_dump_failures
195195
expect(formatter_output.string).to match(/RuntimeError:\n\s+Error: \?\?/m) # ?? because the characters dont encode properly
196196
end

spec/rspec/core/formatters/html_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 = with_safe_set_to_level_that_triggers_security_errors do
17-
RSpec::Core::Formatters::HtmlSnippetExtractor.new.lines_around("blech".taint, 8)
17+
RSpec::Core::Formatters::HtmlSnippetExtractor.new.lines_around("blech".dup.taint, 8)
1818
end
1919
expect(message).to eq("# Couldn't get snippet for blech")
2020
end

spec/rspec/core/formatters/syntax_highlighter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def find_highlighted_terms_in(code_snippet)
8383
highlighted = highlighter.highlight(lines)
8484
highlighted_terms = []
8585

86-
highlighted.join("\n").scan(/\e\[1;[1-9]\dm(\w+)\e\[0m/) do |first_capture, _|
86+
highlighted.join("\n").scan(/\e\[[1-9]\dm(\w+)\e\[0m/) do |first_capture, _|
8787
highlighted_terms << first_capture
8888
end
8989

@@ -124,7 +124,7 @@ def find_highlighted_terms_in(code_snippet)
124124
end
125125

126126
def be_highlighted
127-
include("\e[32m")
127+
include("\e[31m")
128128
end
129129

130130
end

spec/rspec/core/notifications_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def normalize_one_backtrace(exception)
325325
if String.method_defined?(:encoding)
326326
it "returns failures_lines with invalid bytes replace by '?'" do
327327
message_with_invalid_byte_sequence =
328-
"\xEF \255 \xAD I have bad bytes".force_encoding(Encoding::UTF_8)
328+
"\xEF \255 \xAD I have bad bytes".dup.force_encoding(Encoding::UTF_8)
329329
allow(exception).to receive(:message).
330330
and_return(message_with_invalid_byte_sequence)
331331

spec/rspec/core_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def reporter
241241

242242
RSpec.clear_examples
243243

244-
RSpec.configuration.deprecation_stream = StringIO.new(deprecations = "")
244+
RSpec.configuration.deprecation_stream = StringIO.new(deprecations = "".dup)
245245

246246
group = RSpec.describe do
247247
example { RSpec.deprecate("second deprecation") }

0 commit comments

Comments
 (0)