From a10b049e18586166a33157f68da9a2388a7f0831 Mon Sep 17 00:00:00 2001 From: climbus Date: Thu, 24 Feb 2022 12:28:56 +0100 Subject: [PATCH 1/2] test for creating product with unavailable vat rate --- .../test/integration/products_test.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rails_application/test/integration/products_test.rb diff --git a/rails_application/test/integration/products_test.rb b/rails_application/test/integration/products_test.rb new file mode 100644 index 000000000..c36928557 --- /dev/null +++ b/rails_application/test/integration/products_test.rb @@ -0,0 +1,22 @@ +require "test_helper" + +class ProductsTest < InMemoryRESIntegrationTestCase + cover "Products*" + + def setup + Taxes::Configuration.available_vat_rates + end + + def test_add_product_with_worng_vat_rate_code + product_id = SecureRandom.uuid + post "/products", + params: { + "authenticity_token" => "[FILTERED]", + "product_id" => SecureRandom.uuid, + "name" => "Product 1", + "vat_rate" => "50", + } + follow_redirect! + assert_select("#notice", "Selected VAT rate not applicable") + end +end From cddaeeb588dc08df94d72e475d226afb31558b34 Mon Sep 17 00:00:00 2001 From: climbus Date: Thu, 24 Feb 2022 20:45:32 +0100 Subject: [PATCH 2/2] fixed product test --- rails_application/test/integration/products_test.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rails_application/test/integration/products_test.rb b/rails_application/test/integration/products_test.rb index c36928557..e6bcabbb1 100644 --- a/rails_application/test/integration/products_test.rb +++ b/rails_application/test/integration/products_test.rb @@ -3,10 +3,6 @@ class ProductsTest < InMemoryRESIntegrationTestCase cover "Products*" - def setup - Taxes::Configuration.available_vat_rates - end - def test_add_product_with_worng_vat_rate_code product_id = SecureRandom.uuid post "/products",