mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Move tax_category validations test
This commit is contained in:
committed by
Maikel Linke
parent
b2a7a931f3
commit
0df121bcc8
@@ -194,24 +194,6 @@ module Spree
|
||||
expect(build(:simple_product, supplier: nil)).not_to be_valid
|
||||
end
|
||||
|
||||
describe "tax category" do
|
||||
context "when a tax category is required" do
|
||||
it "is invalid when a tax category is not provided" do
|
||||
with_products_require_tax_category(true) do
|
||||
expect(build(:product, tax_category_id: nil)).not_to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when a tax category is not required" do
|
||||
it "is valid when a tax category is not provided" do
|
||||
with_products_require_tax_category(false) do
|
||||
expect(build(:product, tax_category_id: nil)).to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when the product has variants" do
|
||||
let(:product) do
|
||||
product = create(:simple_product)
|
||||
|
||||
@@ -22,6 +22,24 @@ describe Spree::Variant do
|
||||
variant.unit_value = 0
|
||||
expect(variant).to be_invalid
|
||||
end
|
||||
|
||||
describe "tax category" do
|
||||
context "when a tax category is required" do
|
||||
it "is invalid when a tax category is not provided" do
|
||||
with_products_require_tax_category(true) do
|
||||
expect(build_stubbed(:variant, tax_category_id: nil)).not_to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when a tax category is not required" do
|
||||
it "is valid when a tax category is not provided" do
|
||||
with_products_require_tax_category(false) do
|
||||
expect(build_stubbed(:variant, tax_category_id: nil)).to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "price parsing" do
|
||||
|
||||
Reference in New Issue
Block a user