Skip to content

Commit 5448c12

Browse files
authored
Lint: Fix RSpec/RepeatedDescription (#1199)
1 parent 42d6930 commit 5448c12

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

.rubocop.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ RSpec/DescribedClass:
5555
- 'spec/money_spec.rb'
5656
- 'spec/money/formatting_spec.rb'
5757

58+
RSpec/IdenticalEqualityAssertion:
59+
# Allow identical expressions on both sides of the equality since we are
60+
# testing defining equality.
61+
Enabled: false
62+
5863
RSpec/MultipleExpectations:
5964
# Do not limit the amount of expectations in a spec
6065
Enabled: false

.rubocop_todo.yml

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/currency_spec.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,6 @@ def to_s
391391
describe "#inspect" do
392392
it "works as documented" do
393393
expect(described_class.new(:usd).inspect).to eq "#<Money::Currency id: usd, priority: 1, symbol_first: true, thousands_separator: ,, html_entity: $, decimal_mark: ., name: United States Dollar, symbol: $, subunit_to_unit: 100, exponent: 2, iso_code: USD, iso_numeric: 840, subunit: Cent, smallest_denomination: 1, format: >"
394-
end
395-
396-
it "works as documented" do
397394
expect(described_class.new(:aed).inspect).to eq "#<Money::Currency id: aed, priority: 100, symbol_first: false, thousands_separator: ,, html_entity: , decimal_mark: ., name: United Arab Emirates Dirham, symbol: د.إ, subunit_to_unit: 100, exponent: 2, iso_code: AED, iso_numeric: 784, subunit: Fils, smallest_denomination: 25, format: %n %u>"
398395
end
399396
end

spec/money_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -856,17 +856,11 @@
856856

857857
describe "#allocate" do
858858
it "takes no action when one gets all" do
859-
expect(Money.us_dollar(005).allocate([1.0])).to eq [Money.us_dollar(5)]
859+
expect(Money.us_dollar(5).allocate([1.0])).to eq [Money.us_dollar(5)]
860860
end
861861

862862
it "keeps currencies intact" do
863-
expect(Money.ca_dollar(005).allocate([1])).to eq [Money.ca_dollar(5)]
864-
end
865-
866-
it "does not lose pennies" do
867-
moneys = Money.us_dollar(5).allocate([0.3, 0.7])
868-
expect(moneys[0]).to eq Money.us_dollar(2)
869-
expect(moneys[1]).to eq Money.us_dollar(3)
863+
expect(Money.ca_dollar(5).allocate([1])).to eq [Money.ca_dollar(5)]
870864
end
871865

872866
it "handles small splits" do
@@ -881,8 +875,14 @@
881875
expect(moneys[1]).to eq Money.us_dollar(3)
882876
end
883877

884-
it "does not lose pennies" do
885-
moneys = Money.us_dollar(100).allocate([0.333, 0.333, 0.333])
878+
it "does not lose pennies for one decimal" do
879+
moneys = Money.us_dollar(5).allocate([0.3, 0.7])
880+
expect(moneys[0]).to eq Money.us_dollar(2)
881+
expect(moneys[1]).to eq Money.us_dollar(3)
882+
end
883+
884+
it "does not lose pennies for three decimals" do
885+
moneys = Money.us_dollar(1_00).allocate([0.333, 0.333, 0.333])
886886
expect(moneys[0].cents).to eq 34
887887
expect(moneys[1].cents).to eq 33
888888
expect(moneys[2].cents).to eq 33

0 commit comments

Comments
 (0)