Skip to content

Commit

Permalink
Lint: Fix Money spec
Browse files Browse the repository at this point in the history
Rubocop was understandably not happy about comparing very obviously
identical things, so I've made it less obvious by creating a new,
identical object.
  • Loading branch information
mamhoff committed Jan 15, 2025
1 parent 68033cd commit c3dd885
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 0 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,6 @@ Lint/AmbiguousOperator:
- "bin/rails-application-template"
- "bin/rspec"

# Offense count: 1
Lint/BinaryOperatorWithIdenticalOperands:
Exclude:
- "core/spec/lib/spree/money_spec.rb"

# Offense count: 43
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Expand Down
3 changes: 2 additions & 1 deletion core/spec/models/spree/money_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,11 @@
describe "<=>" do
let(:usd_10) { Spree::Money.new(10, currency: "USD") }
let(:usd_20) { Spree::Money.new(20, currency: "USD") }
let(:other_usd_20) { Spree::Money.new(20, currency: "USD") }
let(:usd_30) { Spree::Money.new(30, currency: "USD") }

it "compares the two amounts" do
expect(usd_20 <=> usd_20).to eq 0
expect(usd_20 <=> other_usd_20).to eq 0
expect(usd_20 <=> usd_10).to be > 0
expect(usd_20 <=> usd_30).to be < 0
end
Expand Down

0 comments on commit c3dd885

Please sign in to comment.