Skip to content

Commit

Permalink
Clarify test naming to be more currency agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorostoff-shopify committed Apr 5, 2024
1 parent 00c72b9 commit 06deb44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/allocator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
expect(monies[3]).to eq(Money.new(25.25)) # <-- gets no penny
end

specify "#allocate :roundrobin strategy distributes leftover Yen from left to right" do
specify "#allocate :roundrobin strategy distributes leftovers from left to right when the currency does not use two decimal places (e.g. `JPY`)" do
#Roundrobin for 1 yen
monies = new_allocator(31, 'JPY').allocate([0.5,0.5], :roundrobin)
expect(monies[0]).to eq(Money.new(16, 'JPY'))
Expand All @@ -188,7 +188,7 @@
expect(monies[5]).to eq(Money.new(5860, "JPY")) # <-- gets no yen
end

specify "#allocate :roundrobin_reverse strategy distributes leftover Yen from right to left" do
specify "#allocate :roundrobin_reverse strategy distributes leftovers from right to left when the currency does not use two decimal places (e.g. `JPY`)" do
#Roundrobin for 1 yen
monies = new_allocator(31, 'JPY').allocate([0.5,0.5], :roundrobin_reverse)
expect(monies[0]).to eq(Money.new(15, 'JPY'))
Expand All @@ -204,7 +204,7 @@
expect(monies[5]).to eq(Money.new(5861, "JPY")) # <-- gets 1 yen
end

specify "#allocate :nearest strategy distributes leftover Yen to the nearest whole Yen" do
specify "#allocate :nearest strategy distributes leftovers to the nearest whole subunity when the currency does not use two decimal places (e.g. `JPY`)" do
#Nearest for 1 yen
monies = new_allocator(31, 'JPY').allocate([0.5,0.5], :nearest)
expect(monies[0]).to eq(Money.new(16, 'JPY'))
Expand Down

0 comments on commit 06deb44

Please sign in to comment.