Skip to content

Commit 4595f6c

Browse files
committed
Specs: Silence deprecation warning
Before: > Randomized with seed 53114 > .........................................................................................................................................[WARNING] Using :ruby format when importing rates is potentially unsafe and might lead to remote code execution via Marshal.load deserializer. Consider using safe alternatives such as :json and :yaml. > ........................................................................................................................................................................................................................................................................................................................................................................................... After: > Randomized with seed 30224 > .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... Also moved a few RSpec configuration into their own support files in order to have a more readable RSpec configuration.
1 parent 324bae2 commit 4595f6c

File tree

4 files changed

+42
-35
lines changed

4 files changed

+42
-35
lines changed

spec/spec_helper.rb

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
1818

19-
I18n.enforce_available_locales = false
20-
2119
# This file was generated by the `rspec --init` command. Conventionally, all
2220
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
2321
# The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -117,36 +115,3 @@
117115
Money.default_currency = Money::Currency.new("USD")
118116
end
119117
end
120-
121-
def reset_i18n
122-
I18n.backend = I18n::Backend::Simple.new
123-
end
124-
125-
RSpec.shared_context "with infinite precision", :default_infinite_precision_true do
126-
before do
127-
Money.default_infinite_precision = true
128-
end
129-
130-
after do
131-
Money.default_infinite_precision = false
132-
end
133-
end
134-
135-
class Money
136-
module Warning
137-
def warn(message); end
138-
end
139-
end
140-
141-
class Money
142-
include Warning
143-
extend Warning
144-
end
145-
146-
class Money::LocaleBackend::Base
147-
include Money::Warning
148-
end
149-
150-
class Money::FormattingRules
151-
include Money::Warning
152-
end

spec/support/i18n.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
I18n.enforce_available_locales = false
4+
5+
def reset_i18n
6+
I18n.backend = I18n::Backend::Simple.new
7+
end

spec/support/precision.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.shared_context "with infinite precision", :default_infinite_precision_true do
4+
before do
5+
Money.default_infinite_precision = true
6+
end
7+
8+
after do
9+
Money.default_infinite_precision = false
10+
end
11+
end

spec/support/silence_warnings.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
class Money
4+
module Warning
5+
def warn(message); end
6+
end
7+
end
8+
9+
class Money
10+
include Warning
11+
extend Warning
12+
end
13+
14+
class Money::LocaleBackend::Base
15+
include Money::Warning
16+
end
17+
18+
class Money::FormattingRules
19+
include Money::Warning
20+
end
21+
22+
class Money::Bank::VariableExchange
23+
include Money::Warning
24+
end

0 commit comments

Comments
 (0)