Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix specs not making any assertions #548

Merged
merged 2 commits into from Aug 27, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,8 @@
subclasses of `Money` for comparisons.
- When comparing fails due to `Money::Bank::UnknownRate` `Money#<=>` will now
return `nil` as `Comparable#==` will not rescue exceptions in the next release.
- Fix `Currency` specs for `#exponent` and `#decimal_places` not making assertions.
- Fix a couple of Ruby warnings found in specs.

## 6.6.0
- Fixed VariableExchange#exchange_with for big numbers.
Expand Down
14 changes: 7 additions & 7 deletions spec/currency_spec.rb
Expand Up @@ -5,7 +5,7 @@
class Money
describe Currency do

FOO = '{ "priority": 1, "iso_code": "FOO", "iso_numeric": "840", "name": "United States Dollar", "symbol": "$", "subunit": "Cent", "subunit_to_unit": 450, "symbol_first": true, "html_entity": "$", "decimal_mark": ".", "thousands_separator": ",", "smallest_denomination": 1 }'
FOO = '{ "priority": 1, "iso_code": "FOO", "iso_numeric": "840", "name": "United States Dollar", "symbol": "$", "subunit": "Cent", "subunit_to_unit": 1000, "symbol_first": true, "html_entity": "$", "decimal_mark": ".", "thousands_separator": ",", "smallest_denomination": 1 }'

def register_foo(opts={})
foo_attrs = JSON.parse(FOO, :symbolize_names => true)
Expand Down Expand Up @@ -339,21 +339,21 @@ def to_s

describe "#exponent" do
it "conforms to iso 4217" do
Currency.new(:jpy).exponent == 0
Currency.new(:usd).exponent == 2
Currency.new(:iqd).exponent == 3
expect(Currency.new(:jpy).exponent).to eq 0
expect(Currency.new(:usd).exponent).to eq 2
expect(Currency.new(:iqd).exponent).to eq 3
end
end

describe "#decimal_places" do
it "proper places for known currency" do
Currency.new(:mro).decimal_places == 1
Currency.new(:usd).decimal_places == 2
expect(Currency.new(:mro).decimal_places).to eq 1
expect(Currency.new(:usd).decimal_places).to eq 2
end

it "proper places for custom currency" do
register_foo
Currency.new(:foo).decimal_places == 3
expect(Currency.new(:foo).decimal_places).to eq 3
unregister_foo
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/money/arithmetic_spec.rb
Expand Up @@ -35,7 +35,7 @@
expect(Money.new(1_00, "USD")).not_to eq Object.new
expect(Money.new(1_00, "USD")).not_to eq Class
expect(Money.new(1_00, "USD")).not_to eq Kernel
expect(Money.new(1_00, "USD")).not_to eq /foo/
expect(Money.new(1_00, "USD")).not_to eq(/foo/)
expect(Money.new(1_00, "USD")).not_to eq nil
end

Expand Down
4 changes: 2 additions & 2 deletions spec/rates_store/memory_spec.rb
Expand Up @@ -47,7 +47,7 @@
context 'mutex' do
it 'uses mutex' do
expect(subject.instance_variable_get('@mutex')).to receive(:synchronize)
subject.transaction{ a = 1}
subject.transaction{ 1 + 1 }
end

it 'wraps block in mutex transaction only once' do
Expand All @@ -64,7 +64,7 @@

it 'does not use mutex' do
expect(subject.instance_variable_get('@mutex')).not_to receive(:synchronize)
subject.transaction{ a = 1}
subject.transaction{ 1 + 1 }
end
end
end
Expand Down