Class: FactoryGirl::Strategy::Stub

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_girl/strategy/stub.rb

Constant Summary collapse

DISABLED_PERSISTENCE_METHODS =
[
  :connection,
  :decrement!,
  :decrement,
  :delete,
  :destroy!,
  :destroy,
  :increment!,
  :increment,
  :reload,
  :save!,
  :save,
  :toggle!,
  :toggle,
  :touch,
  :update!,
  :update,
  :update_attribute,
  :update_attributes!,
  :update_attributes,
  :update_column,
  :update_columns,
].freeze
@@next_id =
1000

Instance Method Summary collapse

Instance Method Details

#association(runner) ⇒ Object



30
31
32
# File 'lib/factory_girl/strategy/stub.rb', line 30

def association(runner)
  runner.run(:build_stubbed)
end

#result(evaluation) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/factory_girl/strategy/stub.rb', line 34

def result(evaluation)
  evaluation.object.tap do |instance|
    stub_database_interaction_on_result(instance)
    clear_changed_attributes_on_result(instance)
    evaluation.notify(:after_stub, instance)
  end
end