mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
Rails 5 is a bit stricter and Spree's Config#set method doesn't work with a Parameters object.
40 lines
813 B
Ruby
40 lines
813 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
describe Spree::Admin::TaxSettingsController, type: :controller do
|
|
describe "#update" do
|
|
let(:params) {
|
|
{
|
|
preferences: {
|
|
products_require_tax_category: "1",
|
|
shipment_inc_vat: "0",
|
|
shipping_tax_rate: "0.1",
|
|
}
|
|
}
|
|
}
|
|
|
|
before do
|
|
allow(controller).to receive(:spree_current_user) { create(:admin_user) }
|
|
end
|
|
|
|
it "changes Tax settings" do
|
|
expect {
|
|
spree_post :update, params
|
|
}.to change {
|
|
[
|
|
Spree::Config[:products_require_tax_category],
|
|
Spree::Config[:shipment_inc_vat],
|
|
Spree::Config[:shipping_tax_rate],
|
|
]
|
|
}.to(
|
|
[
|
|
true,
|
|
false,
|
|
0.1,
|
|
]
|
|
)
|
|
end
|
|
end
|
|
end
|