Class: FactoryGirl::Strategy

Inherits:
Object
  • Object
show all
Includes:
Observable
Defined in:
lib/factory_girl/strategy.rb,
lib/factory_girl/strategy/null.rb,
lib/factory_girl/strategy/stub.rb,
lib/factory_girl/strategy/build.rb,
lib/factory_girl/strategy/create.rb,
lib/factory_girl/strategy/attributes_for.rb

Overview

:nodoc:

Direct Known Subclasses

AttributesFor, Build, Create, Stub

Defined Under Namespace

Classes: AttributesFor, Build, Create, Null, Stub

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ensure_strategy_exists!(strategy) ⇒ Object



20
21
22
23
24
# File 'lib/factory_girl/strategy.rb', line 20

def self.ensure_strategy_exists!(strategy)
  unless Strategy.const_defined? strategy.to_s.camelize
    raise ArgumentError, "Unknown strategy: #{strategy}"
  end
end

Instance Method Details

#association(runner) ⇒ Object

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/factory_girl/strategy.rb', line 12

def association(runner)
  raise NotImplementedError, "Strategies must return an association"
end

#result(attribute_assigner, to_create) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/factory_girl/strategy.rb', line 16

def result(attribute_assigner, to_create)
  raise NotImplementedError, "Strategies must return a result"
end