module FactoryBot
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/factory_bot.rbs module FactoryBot def self.aliases_for: (Symbol attribute) -> untyped end
def self.aliases_for(attribute)
Experimental RBS support (using type sampling data from the type_fusion
project).
def self.aliases_for: (Symbol attribute) -> untyped
This signature was generated using 156 samples from 3 applications.
def self.aliases_for(attribute) aliases.map { |(pattern, replace)| if pattern.match?(attribute) attribute.to_s.sub(pattern, replace).to_sym end }.compact << attribute end
def self.build_stubbed_starting_id=(starting_id)
* starting_id +Integer+
Arguments:
Set the starting value for ids when using the build_stubbed strategy
def self.build_stubbed_starting_id=(starting_id) Strategy::Stub.next_id = starting_id - 1 end
def self.find_definitions
def self.find_definitions absolute_definition_file_paths = definition_file_paths.map { |path| File.expand_path(path) } absolute_definition_file_paths.uniq.each do |path| load("#{path}.rb") if File.exist?("#{path}.rb") if File.directory? path Dir[File.join(path, "**", "*.rb")].sort.each do |file| load file end end end end
def self.lint(*args)
strategy: :create - to specify the strategy for linting
traits: true - to lint traits as well as factories
options:
factories - which factories to lint; omit for all factories
Parameters:
Look for errors in factories and (optionally) their traits.
def self.lint(*args) options = args.extract_options! factories_to_lint = args[0] || FactoryBot.factories Linter.new(factories_to_lint, **options).lint! end
def self.reload
def self.reload Internal.reset_configuration Internal.register_default_strategies find_definitions end