Module: FactoryBot::Blueprint::Methods

Defined in:
lib/factory_bot/blueprint/methods.rb

Overview

This module provides a shortcut to FactoryBot::Blueprint.

Examples:

# Configure the same way as FactoryBot::Syntax::Methods
RSpec.configure do |config|
  config.include FactoryBot::Syntax::Methods
  config.include FactoryBot::Blueprint::Methods
end

# You can use `bp` in your spec files
RSpec.describe "something" do
  before do
    bp.create do
      blog do
        article(title: "Article 1")
        article(title: "Article 2")
        article(title: "Article 3") do
          comment(name: "John")
          comment(name: "Doe")
        end
      end
    end
  end
end

Instance Method Summary collapse

Instance Method Details

#bpClass<FactoryBot::Blueprint>

Returns:



30
# File 'lib/factory_bot/blueprint/methods.rb', line 30

def bp = FactoryBot::Blueprint