From ed5c750199fc0db72a6cd15501c4e1825e04c811 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 02:19:28 +0000 Subject: [PATCH 1/4] chore(deps-dev): bump webmock from 3.18.1 to 3.19.1 Bumps [webmock](https://github.com/bblimke/webmock) from 3.18.1 to 3.19.1. - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/compare/v3.18.1...v3.19.1) --- updated-dependencies: - dependency-name: webmock dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7f4a28cb3a..480b881379 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -773,7 +773,7 @@ GEM webfinger (1.2.0) activesupport httpclient (>= 2.4) - webmock (3.18.1) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) From f500d1e7a810ac6ec103a4709fc181e2ac7d0b92 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 5 Sep 2023 10:33:49 +0200 Subject: [PATCH 2/4] Instead of stubbing CSS pack requests, ignore them with VCR --- spec/system/admin/invoice_print_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/system/admin/invoice_print_spec.rb b/spec/system/admin/invoice_print_spec.rb index 790db07849..1f333f1495 100644 --- a/spec/system/admin/invoice_print_spec.rb +++ b/spec/system/admin/invoice_print_spec.rb @@ -29,7 +29,12 @@ describe ' before do Capybara.current_driver = :rack_test - stub_request(:get, ->(uri) { uri.to_s.include? "/css/mail" }) + # Ignore request for CSS pack like: 'http://www.example.com/packs-test/css/mail-1ab2dc7f.css' + VCR.configure do |config| + config.ignore_request do |request| + request.uri.to_s.include?('packs-test/css/mail') + end + end end after do From 9ea6fc00cb25a6b948e93b0ec2f6e58513cf257e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 5 Sep 2023 14:03:41 +0200 Subject: [PATCH 3/4] Ignore `test.host` host to avoid error ``` Failed to open TCP connection to test.host:80 ``` --- spec/views/spree/admin/orders/invoice.html.haml_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/views/spree/admin/orders/invoice.html.haml_spec.rb b/spec/views/spree/admin/orders/invoice.html.haml_spec.rb index e6cccbdced..c833bca906 100644 --- a/spec/views/spree/admin/orders/invoice.html.haml_spec.rb +++ b/spec/views/spree/admin/orders/invoice.html.haml_spec.rb @@ -27,7 +27,10 @@ describe "spree/admin/orders/invoice.html.haml" do display_checkout_total_less_tax: '8', outstanding_balance_label: 'Outstanding Balance' - stub_request(:get, ->(uri) { uri.to_s.include? "/css/mail" }) + # Ignore requests for CSS pack like: 'http://test.host/packs-test/css/mail-1ab2dc7f.css' + VCR.configure do |config| + config.ignore_hosts('test.host') + end end it "displays the customer code" do From 557e6e6a3737deddfc5279bc9ed4f02d266d6d5e Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Wed, 10 Jan 2024 16:46:13 +1100 Subject: [PATCH 4/4] Return a duplicate empty string for css pack request --- spec/system/admin/invoice_print_spec.rb | 12 ++++++------ .../spree/admin/orders/invoice.html.haml_spec.rb | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/spec/system/admin/invoice_print_spec.rb b/spec/system/admin/invoice_print_spec.rb index 1f333f1495..45a6823706 100644 --- a/spec/system/admin/invoice_print_spec.rb +++ b/spec/system/admin/invoice_print_spec.rb @@ -29,12 +29,12 @@ describe ' before do Capybara.current_driver = :rack_test - # Ignore request for CSS pack like: 'http://www.example.com/packs-test/css/mail-1ab2dc7f.css' - VCR.configure do |config| - config.ignore_request do |request| - request.uri.to_s.include?('packs-test/css/mail') - end - end + + # return a duplicate empaty string for CSS pack request like: + # 'http://test.host/packs-test/css/mail-1ab2dc7f.css' + # This is because Wicked PDF will try to force an encoding on the returned string, which will + # break with a frozen string + stub_request(:get, ->(uri) { uri.to_s.include? "/css/mail" }).to_return(body: "".dup) end after do diff --git a/spec/views/spree/admin/orders/invoice.html.haml_spec.rb b/spec/views/spree/admin/orders/invoice.html.haml_spec.rb index c833bca906..f0aebd480e 100644 --- a/spec/views/spree/admin/orders/invoice.html.haml_spec.rb +++ b/spec/views/spree/admin/orders/invoice.html.haml_spec.rb @@ -27,10 +27,11 @@ describe "spree/admin/orders/invoice.html.haml" do display_checkout_total_less_tax: '8', outstanding_balance_label: 'Outstanding Balance' - # Ignore requests for CSS pack like: 'http://test.host/packs-test/css/mail-1ab2dc7f.css' - VCR.configure do |config| - config.ignore_hosts('test.host') - end + # return a duplicate empaty string for CSS pack request like: + # 'http://test.host/packs-test/css/mail-1ab2dc7f.css' + # This is because Wicked PDF will try to force an encoding on the returned string, which will + # break with a frozen string + stub_request(:get, ->(uri) { uri.to_s.include? "/css/mail" }).to_return(body: "".dup) end it "displays the customer code" do