From 7176948ce526f3543b8fc6555f0a0ea843af34f8 Mon Sep 17 00:00:00 2001 From: Madeline Collier Date: Thu, 8 Aug 2024 12:33:42 +0200 Subject: [PATCH] Fix failing solidus_admin thumbnail spec Failure: /spec/components/solidus_admin/ui/thumbnail/component_spec.rb:6 Error: /home/circleci/solidus/admin/spec/components/previews/solidus_admin/ui/thumbnail/component_preview/overview.html.erb:53: numbered parameter is already used in /home/circleci/solidus/admin/spec/components/previews/solidus_admin/ui/thumbnail/component_preview/overview.html.erb:52: outer block here Failure/Error: <% image = Spree::Image.new.tap { _1.define_singleton_method(:attachment) { attachment } } %> By replaing the second instance of numbered params, we can avoid this error with no behavioural or functional changes to the code. Interestingly though, it was only failing on 2 out of our 8 spec runs, and it did so consistently. --- .../ui/thumbnail/component_preview/overview.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/spec/components/previews/solidus_admin/ui/thumbnail/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/ui/thumbnail/component_preview/overview.html.erb index caa4fb043ee..9d9db7f2628 100644 --- a/admin/spec/components/previews/solidus_admin/ui/thumbnail/component_preview/overview.html.erb +++ b/admin/spec/components/previews/solidus_admin/ui/thumbnail/component_preview/overview.html.erb @@ -50,7 +50,7 @@
<% product = Spree::Product.new(name: "A good product") %> <% attachment = Object.new.tap { def _1.url(*) "https://placekitten.com/280/200"; end } %> - <% image = Spree::Image.new.tap { _1.define_singleton_method(:attachment) { attachment } } %> + <% image = Spree::Image.new.tap { |img| img.define_singleton_method(:attachment) { attachment } } %> <% [ Spree::UnitCancel.new, Spree::TaxRate.new,