Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

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

I18n.enforce_available_locales = false

# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand Down Expand Up @@ -111,39 +109,4 @@
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed

config.before(:each) do
Money.default_currency = Money::Currency.new("USD")
end

config.before(:each, :default_infinite_precision_true) do
Money.default_infinite_precision = true
end

config.after(:each, :default_infinite_precision_true) do
Money.default_infinite_precision = false
end
end

def reset_i18n
I18n.backend = I18n::Backend::Simple.new
end

class Money
module Warning
def warn(message); end
end
end

class Money
include Warning
extend Warning
end

class Money::LocaleBackend::Base
include Money::Warning
end

class Money::FormattingRules
include Money::Warning
end
7 changes: 7 additions & 0 deletions spec/support/default_currency.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

RSpec.configure do |config|
config.before(:each) do
Money.default_currency = Money::Currency.new("USD")
end
end
7 changes: 7 additions & 0 deletions spec/support/i18n.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

I18n.enforce_available_locales = false

def reset_i18n
I18n.backend = I18n::Backend::Simple.new
end
11 changes: 11 additions & 0 deletions spec/support/precision.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

RSpec.configure do |config|
config.before(:each, :default_infinite_precision_true) do
Money.default_infinite_precision = true
end

config.after(:each, :default_infinite_precision_true) do
Money.default_infinite_precision = false
end
end
24 changes: 24 additions & 0 deletions spec/support/silence_warnings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

class Money
module Warning
def warn(message); end
end
end

class Money
include Warning
extend Warning
end

class Money::LocaleBackend::Base
include Money::Warning
end

class Money::FormattingRules
include Money::Warning
end

class Money::Bank::VariableExchange
include Money::Warning
end
Comment on lines +22 to +24
Copy link
Member Author

@sunny sunny Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the include that silences the current warn in the specs.