Skip to content
Merged
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
10 changes: 0 additions & 10 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/money/bank/variable_exchange.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def export_rates(format, file = nil, _opts = {})
s = FORMAT_SERIALIZERS[format].dump(rates)

unless file.nil?
File.open(file, "w") { |f| f.write(s) }
File.write(file, s)
end

s
Expand Down
2 changes: 1 addition & 1 deletion lib/money/currency/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Money
class Currency
module Loader
DATA_PATH = File.expand_path("../../../../config", __FILE__)
DATA_PATH = File.expand_path("../../../config", __dir__)

class << self
# Loads and returns the currencies stored in JSON files in the config directory.
Expand Down
8 changes: 3 additions & 5 deletions spec/bank/variable_exchange_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,11 @@

context "with :file provided" do
it "writes rates to file" do
f = instance_double(IO)
allow(File).to receive(:open).with('null', 'w').and_yield(f)
allow(f).to receive(:write)
allow(File).to receive(:write)

bank.export_rates(:json, 'null')
bank.export_rates(:json, "null")

expect(f).to have_received(:write).with(JSON.dump(expected_rates))
expect(File).to have_received(:write).with("null", JSON.dump(expected_rates))
end
end

Expand Down