Class: FactoryGirl::Strategy::Stub

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

Constant Summary

DISABLED_PERSISTENCE_METHODS =
[
  :connection,
  :decrement!,
  :decrement,
  :delete,
  :destroy!,
  :destroy,
  :destroyed?,
  :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



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

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

#result(evaluation) ⇒ Object



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

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