Update TaxRatesController spec

BigDecimal was throwing an error here (in Rails 5) unless it received a string, but I think this is actually an issue with the way params were being passed in the relevant spec, as opposed to the controller itself.
This commit is contained in:
Matt-Yorkley
2021-02-09 11:56:00 +00:00
parent 4c4142c56d
commit 78eb5d23f9

View File

@@ -20,7 +20,7 @@ module Spree
context "when the amount is not changed" do
it "updates the record" do
expect {
spree_put :update, id: tax_rate.id, tax_rate: { name: "Updated Rate", amount: 0.1 }
spree_put :update, id: tax_rate.id, tax_rate: { name: "Updated Rate", amount: "0.1" }
}.to_not change{ Spree::TaxRate.with_deleted.count }
expect(response).to redirect_to spree.admin_tax_rates_url
@@ -32,7 +32,7 @@ module Spree
context "when the amount is changed" do
it "duplicates the record and soft-deletes the duplicate" do
expect {
spree_put :update, id: tax_rate.id, tax_rate: { name: "Changed Rate", amount: 0.5 }
spree_put :update, id: tax_rate.id, tax_rate: { name: "Changed Rate", amount: "0.5" }
}.to change{ Spree::TaxRate.with_deleted.count }.by(1)
expect(response).to redirect_to spree.admin_tax_rates_url