Sha256: 8e2ed43430c355ac0bca2b6194a9a9de87846169c5a7dd787e0e645c43e459e7
Contents?: true
Size: 1.68 KB
Versions: 23
Compression:
Stored size: 1.68 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec module FactoryBot # @!parse # # Use shorthands from `FactoryBot::Syntax::Methods` in your specs. # # # # @safety # # The autocorrection is marked as unsafe because the cop # # cannot verify whether you already include # # `FactoryBot::Syntax::Methods` in your test suite. # # # # If you're using Rails, add the following configuration to # # `spec/support/factory_bot.rb` and be sure to require that file # # in `rails_helper.rb`: # # # # [source,ruby] # # ---- # # RSpec.configure do |config| # # config.include FactoryBot::Syntax::Methods # # end # # ---- # # # # If you're not using Rails: # # # # [source,ruby] # # ---- # # RSpec.configure do |config| # # config.include FactoryBot::Syntax::Methods # # # # config.before(:suite) do # # FactoryBot.find_definitions # # end # # end # # ---- # # # # @example # # # bad # # FactoryBot.create(:bar) # # FactoryBot.build(:bar) # # FactoryBot.attributes_for(:bar) # # # # # good # # create(:bar) # # build(:bar) # # attributes_for(:bar) # # # class SyntaxMethods < ::RuboCop::Cop::Base; end SyntaxMethods = ::RuboCop::Cop::FactoryBot::SyntaxMethods end end end end
Version data entries
23 entries across 23 versions & 4 rubygems