Module: StandardId::Testing

Defined in:
lib/standard_id/testing.rb,
lib/standard_id/testing/request_helpers.rb,
lib/standard_id/testing/authentication_helpers.rb

Defined Under Namespace

Modules: AuthenticationHelpers, RequestHelpers

Class Method Summary collapse

Class Method Details

.setup_factory_bot!Object

Load StandardId’s FactoryBot factory definitions.

Requires the ‘factory_bot` (or `factory_bot_rails`) gem in the host app’s Gemfile under the :test group.

Recommended usage in rails_helper.rb:

require "standard_id/testing"
StandardId::Testing.setup_factory_bot!


16
17
18
19
20
21
22
23
24
# File 'lib/standard_id/testing.rb', line 16

def self.setup_factory_bot!
  require "standard_id/testing/factory_bot"
rescue LoadError => e
  raise unless e.message.include?("factory_bot")

  raise LoadError,
    "StandardId::Testing.setup_factory_bot! requires the `factory_bot` gem. " \
    "Add `gem 'factory_bot_rails'` (or `gem 'factory_bot'`) to your Gemfile's :test group."
end