Skip to content

Commit

Permalink
Fix back compatiblity
Browse files Browse the repository at this point in the history
We need to make sure these strings are muable, but `String#+@` is only
available in Ruby 2.3+ and the gem doesn't yet restrict the Ruby version
we're compatible with.

Fix backwards compatiblity by releasing a version using `String#dup`,
then we can add the Ruby version restriction in the Gemfile and revert
to `String#+@`.
  • Loading branch information
sj26 committed Jan 6, 2022
1 parent 7f69b4f commit 915c2a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rspec_junit_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def xml_dump_output(example)

# Inversion of character range from https://www.w3.org/TR/xml/#charsets
ILLEGAL_REGEXP = Regexp.new(
+"[^" <<
"[^".dup <<
"\u{9}" << # => \t
"\u{a}" << # => \n
"\u{d}" << # => \r
Expand Down Expand Up @@ -125,7 +125,7 @@ def xml_dump_output(example)
# Discouraged characters from https://www.w3.org/TR/xml/#charsets
# Plus special characters with well-known entity replacements
DISCOURAGED_REGEXP = Regexp.new(
+"[" <<
"[".dup <<
"\u{22}" << # => "
"\u{26}" << # => &
"\u{27}" << # => '
Expand Down

0 comments on commit 915c2a4

Please sign in to comment.