Fixes RSpecRailsInferredSpecType

This commit is contained in:
cyrillefr
2025-05-21 09:43:24 +02:00
parent 2f5981af59
commit 758d78bfe4
18 changed files with 18 additions and 35 deletions

View File

@@ -221,28 +221,11 @@ Metrics/PerceivedComplexity:
- 'app/models/spree/ability.rb'
- 'app/models/spree/order/checkout.rb'
# Offense count: 18
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Inferences.
RSpecRails/InferredSpecType:
Exclude:
- 'spec/requests/admin/images_spec.rb'
- 'spec/requests/admin/product_import_spec.rb'
- 'spec/requests/admin/vouchers_spec.rb'
- 'spec/requests/api/orders_spec.rb'
- 'spec/requests/api/routes_spec.rb'
- 'spec/requests/api/v1/customers_spec.rb'
- 'spec/requests/api_docs_spec.rb'
- 'spec/requests/checkout/paypal_spec.rb'
- 'spec/requests/checkout/routes_spec.rb'
- 'spec/requests/checkout/stripe_sca_spec.rb'
- 'spec/requests/errors_spec.rb'
- 'spec/requests/home_controller_spec.rb'
- 'spec/requests/large_request_spec.rb'
- 'spec/requests/omniauth_callbacks_controller_spec.rb'
- 'spec/requests/spree/admin/overview_spec.rb'
- 'spec/requests/spree/admin/payments_spec.rb'
- 'spec/requests/voucher_adjustments_spec.rb'
- 'spec/routing/stripe_spec.rb'
# Offense count: 1

View File

@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe "/admin/products/:product_id/images", type: :request do
RSpec.describe "/admin/products/:product_id/images" do
include AuthenticationHelper
let!(:product) { create(:product) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe "Product Import", type: :request do
RSpec.describe "Product Import" do
include AuthenticationHelper
describe "validate_data" do

View File

@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe "/admin/enterprises/:enterprise_id/vouchers", type: :request do
RSpec.describe "/admin/enterprises/:enterprise_id/vouchers" do
let(:enterprise) { create(:supplier_enterprise, name: "Feedme") }
let(:enterprise_user) { create(:user, enterprise_limit: 1) }

View File

@@ -2,7 +2,7 @@
require 'swagger_helper'
RSpec.describe 'api/v0/orders', swagger_doc: 'v0.yaml', type: :request do
RSpec.describe 'api/v0/orders', swagger_doc: 'v0.yaml' do
path '/api/v0/orders' do
get('list orders') do
tags 'Orders'

View File

@@ -3,7 +3,7 @@
# test a single endpoint to make sure the redirects are working as intended.
require 'spec_helper'
RSpec.describe 'Orders Cycles endpoint', type: :request do
RSpec.describe 'Orders Cycles endpoint' do
let(:distributor) { create(:distributor_enterprise) }
let(:order_cycle) { create(:order_cycle, distributors: [distributor]) }

View File

@@ -2,7 +2,7 @@
require "swagger_helper"
RSpec.describe "Customers", type: :request, swagger_doc: "v1.yaml", feature: :api_v1 do
RSpec.describe "Customers", swagger_doc: "v1.yaml", feature: :api_v1 do
let!(:enterprise1) { create(:enterprise, name: "The Farm") }
let!(:enterprise2) { create(:enterprise) }
let!(:enterprise3) { create(:enterprise) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe "API documentation", type: :request do
RSpec.describe "API documentation" do
it "shows the OFN API v1" do
get rswag_ui_path
expect(response).to redirect_to "/api-docs/index.html"

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe "checking out an order with a paypal express payment method", type: :request do
RSpec.describe "checking out an order with a paypal express payment method" do
include ShopWorkflow
include PaypalHelper

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe 'checkout endpoints', type: :request do
RSpec.describe 'checkout endpoints' do
include ShopWorkflow
let!(:shop) { create(:enterprise) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe "checking out an order with a Stripe SCA payment method", type: :request do
RSpec.describe "checking out an order with a Stripe SCA payment method" do
include ShopWorkflow
include AuthenticationHelper
include OpenFoodNetwork::ApiHelper

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe 'Errors', type: :request do
RSpec.describe 'Errors' do
include ExceptionHelper
shared_examples "returning a HTTP 404" do |path|

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe HomeController, type: :request do
RSpec.describe HomeController do
context "#unauthorized" do
it "renders the unauthorized template" do
get "/unauthorized"

View File

@@ -5,7 +5,7 @@
# http://daniel.fone.net.nz/blog/2014/11/28/actiondispatch-cookies-cookieoverflow-via-devise-s-user_return_to/
require 'spec_helper'
RSpec.describe 'A very large request', type: :request do
RSpec.describe 'A very large request' do
it 'should not overflow cookies' do
get '/admin', params: { foo: 'x' * ActionDispatch::Cookies::MAX_COOKIE_SIZE }
expect(response).to have_http_status(:redirect)

View File

@@ -3,7 +3,7 @@
require 'spec_helper'
# Devise calls OmniauthCallbacksController for OpenID Connect callbacks.
RSpec.describe '/user/spree_user/auth/openid_connect/callback', type: :request do
RSpec.describe '/user/spree_user/auth/openid_connect/callback' do
include AuthenticationHelper
let(:user) { create(:user) }

View File

@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe "/admin", type: :request do
RSpec.describe "/admin" do
let(:enterprise) { create(:supplier_enterprise, name: "Feedme") }
let(:enterprise_user) { create(:user, enterprise_limit: 1) }

View File

@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe Spree::Admin::PaymentsController, type: :request do
RSpec.describe Spree::Admin::PaymentsController do
let(:user) { order.user }
let(:order) { create(:completed_order_with_fees) }

View File

@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe VoucherAdjustmentsController, type: :request do
RSpec.describe VoucherAdjustmentsController do
let(:user) { order.user }
let(:address) { create(:address) }
let(:distributor) { create(:distributor_enterprise, with_payment_and_shipping: true) }