Skip to content

Commit 2b87b46

Browse files
nobueregon
authored andcommitted
Fixed a global constant leak
1 parent 5104768 commit 2b87b46

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

core/env/spec_helper.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require_relative '../../spec_helper'
22

3-
class BeLocaleEnvEncodingString
3+
locale_env_matcher = Class.new do
44
def initialize(name = 'locale')
55
encoding = Encoding.find(name)
66
@encodings = (encoding = Encoding::US_ASCII) ?
@@ -21,8 +21,6 @@ def negative_failure_message
2121
end
2222
end
2323

24-
class String
25-
def be_locale_env(expected = 'locale')
26-
BeLocaleEnvEncodingString.new(expected)
27-
end
24+
String.__send__(:define_method, :be_locale_env) do |expected = 'locale'|
25+
locale_env_matcher.new(expected)
2826
end

0 commit comments

Comments
 (0)