Move tax_category validations test

This commit is contained in:
Matt-Yorkley
2023-07-03 15:20:22 +01:00
committed by Maikel Linke
parent b2a7a931f3
commit 0df121bcc8
2 changed files with 18 additions and 18 deletions

View File

@@ -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)

View File

@@ -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