From 65708913496fde1b7e6265a28b4236cd1dd0f0fc Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 5 Apr 2023 17:00:10 +1000 Subject: [PATCH] Fix linter issues Although I don't think the size was an issue here, small hashes can easily fit on one line. --- app/helpers/spree/admin/base_helper.rb | 47 +++++++++--------------- spec/system/admin/payment_method_spec.rb | 4 +- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/app/helpers/spree/admin/base_helper.rb b/app/helpers/spree/admin/base_helper.rb index 07334812f8..d527b04d1d 100644 --- a/app/helpers/spree/admin/base_helper.rb +++ b/app/helpers/spree/admin/base_helper.rb @@ -80,35 +80,24 @@ module Spree end def preference_field_options(options) - field_options = case options[:type] - when :integer - { - size: 10, - class: 'input_integer', - step: 1, - } - when :decimal - { - size: 10, - class: 'input_integer', - step: :any, # Allow any number of decimal places - } - when :boolean - {} - when :string - { size: 10, - class: 'input_string fullwidth' } - when :password - { size: 10, - class: 'password_string fullwidth' } - when :text - { rows: 15, - cols: 85, - class: 'fullwidth' } - else - { size: 10, - class: 'input_string fullwidth' } - end + field_options = + case options[:type] + when :integer + { size: 10, class: 'input_integer', step: 1 } + when :decimal + # Allow any number of decimal places + { size: 10, class: 'input_integer', step: :any } + when :boolean + {} + when :string + { size: 10, class: 'input_string fullwidth' } + when :password + { size: 10, class: 'password_string fullwidth' } + when :text + { rows: 15, cols: 85, class: 'fullwidth' } + else + { size: 10, class: 'input_string fullwidth' } + end field_options.merge!( readonly: options[:readonly], diff --git a/spec/system/admin/payment_method_spec.rb b/spec/system/admin/payment_method_spec.rb index b8044e3012..412c28ee8a 100644 --- a/spec/system/admin/payment_method_spec.rb +++ b/spec/system/admin/payment_method_spec.rb @@ -441,7 +441,7 @@ describe ' expect(page).to have_field 'Amount', with: '10.0' expect(page).not_to have_field 'payment_method_name', with: '' expect(page).not_to have_field 'payment_method_description', with: 'Edited description' - expect(page).not_to have_unchecked_field "payment_method_distributor_ids_#{@distributors[0].id}" + expect(page).to have_checked_field "payment_method_distributor_ids_#{@distributors[0].id}" end end @@ -508,7 +508,7 @@ describe ' expect(page).to have_field 'Amount', with: '10.0' expect(page).not_to have_field 'payment_method_name', with: '' expect(page).not_to have_field 'payment_method_description', with: 'Edited description' - expect(page).not_to have_unchecked_field "payment_method_distributor_ids_#{@distributors[0].id}" + expect(page).to have_checked_field "payment_method_distributor_ids_#{@distributors[0].id}" end end end