Fixes RSpecRailsInferredSpecType offenses in helpers

This commit is contained in:
cyrillefr
2025-05-20 12:54:04 +02:00
parent 67f5ae811b
commit 8be1045f23
20 changed files with 20 additions and 39 deletions

View File

@@ -221,30 +221,11 @@ Metrics/PerceivedComplexity:
- 'app/models/spree/ability.rb'
- 'app/models/spree/order/checkout.rb'
# Offense count: 56
# Offense count: 37
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Inferences.
RSpecRails/InferredSpecType:
Exclude:
- 'spec/helpers/admin/enterprises_helper_spec.rb'
- 'spec/helpers/admin/orders_helper_spec.rb'
- 'spec/helpers/admin/reports_helper_spec.rb'
- 'spec/helpers/admin/subscriptions_helper_spec.rb'
- 'spec/helpers/application_helper_spec.rb'
- 'spec/helpers/checkout_helper_spec.rb'
- 'spec/helpers/i18n_helper_spec.rb'
- 'spec/helpers/injection_helper_spec.rb'
- 'spec/helpers/link_helper_spec.rb'
- 'spec/helpers/navigation_helper_spec.rb'
- 'spec/helpers/order_cycles_helper_spec.rb'
- 'spec/helpers/serializer_helper_spec.rb'
- 'spec/helpers/shop_helper_spec.rb'
- 'spec/helpers/spree/admin/base_helper_spec.rb'
- 'spec/helpers/spree/admin/general_settings_helper_spec.rb'
- 'spec/helpers/spree/admin/orders_helper_spec.rb'
- 'spec/helpers/spree/orders_helper_spec.rb'
- 'spec/helpers/tax_helper_spec.rb'
- 'spec/helpers/terms_and_conditions_helper_spec.rb'
- 'spec/jobs/connect_app_job_spec.rb'
- 'spec/mailers/producer_mailer_spec.rb'
- 'spec/mailers/subscription_mailer_spec.rb'

View File

@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe Admin::EnterprisesHelper, type: :helper do
RSpec.describe Admin::EnterprisesHelper do
let(:user) { build(:user) }
before do

View File

@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe Admin::OrdersHelper, type: :helper do
RSpec.describe Admin::OrdersHelper do
describe "#order_adjustments_for_display" do
let(:order) { create(:order) }
let(:service) { instance_double(VoucherAdjustmentsService, voucher_included_tax:) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe ReportsHelper, type: :helper do
RSpec.describe ReportsHelper do
describe "#report_payment_method_options" do
let(:order_with_payments) { create(:order_ready_to_ship) }
let(:order_without_payments) { create(:order_with_line_items) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Admin::SubscriptionsHelper, type: :helper do
RSpec.describe Admin::SubscriptionsHelper do
describe "checking if setup is complete for any [shop]" do
let(:shop) { create(:distributor_enterprise) }
let(:customer) { create(:customer, enterprise: shop) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe ApplicationHelper, type: :helper do
RSpec.describe ApplicationHelper do
describe "#feature?" do
it "takes several actors" do
user = Spree::User.new(id: 4)

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe CheckoutHelper, type: :helper do
RSpec.describe CheckoutHelper do
it "generates html for validated inputs" do
expect(helper).to receive(:render).with(
"shared/validated_input",

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe I18nHelper, type: :helper do
RSpec.describe I18nHelper do
let(:user) { create(:user) }
let(:cookies) { {} }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe InjectionHelper, type: :helper do
RSpec.describe InjectionHelper do
let!(:enterprise) { create(:distributor_enterprise, facebook: "roger") }
let!(:distributor1) { create(:distributor_enterprise) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe LinkHelper, type: :helper do
RSpec.describe LinkHelper do
describe "ext_url" do
it "adds prefix if missing" do
expect(helper.ext_url("http://example.com/", "http://example.com/bla")).to eq("http://example.com/bla")

View File

@@ -4,7 +4,7 @@ require 'spec_helper'
module Spree
module Admin
RSpec.describe NavigationHelper, type: :helper do
RSpec.describe NavigationHelper do
describe "klass_for" do
it "returns the class when present" do
expect(helper.klass_for('products')).to eq(Spree::Product)

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe OrderCyclesHelper, type: :helper do
RSpec.describe OrderCyclesHelper do
let(:oc) { double(:order_cycle) }
describe "finding producer enterprise options" do

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe SerializerHelper, type: :helper do
RSpec.describe SerializerHelper do
let(:serializer) do
Class.new(ActiveModel::Serializer) do
attributes :id, :name

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: false
require 'spec_helper'
RSpec.describe ShopHelper, type: :helper do
RSpec.describe ShopHelper do
describe "shop_tabs" do
context "distributor with groups" do
let(:group) { create(:enterprise_group) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Spree::Admin::BaseHelper, type: :helper do
RSpec.describe Spree::Admin::BaseHelper do
helper 'spree/admin/navigation'
describe "#link_to_remove_fields" do

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Spree::Admin::GeneralSettingsHelper, type: :helper do
RSpec.describe Spree::Admin::GeneralSettingsHelper do
describe "#all_units" do
it "returns all units" do
expect(helper.all_units).to eq(["mg", "g", "kg", "T", "oz", "lb", "mL", "cL", "dL", "L",

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Spree::Admin::OrdersHelper, type: :helper do
RSpec.describe Spree::Admin::OrdersHelper do
describe "#orders_links" do
let(:order) { double(:order) }
let(:distributor) { double(:enterprise) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Spree::OrdersHelper, type: :helper do
RSpec.describe Spree::OrdersHelper do
describe "#changeable_orders" do
let(:complete_orders) { double(:complete_orders, where: "some_orders") }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe TaxHelper, type: :helper do
RSpec.describe TaxHelper do
let(:line_item) { create(:line_item) }
let(:line_item2) { create(:line_item) }
let(:line_item3) { create(:line_item) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe TermsAndConditionsHelper, type: :helper do
RSpec.describe TermsAndConditionsHelper do
describe "#platform_terms_required?" do
context 'when ToS file is present' do
before do