Class: ValkyrieCreateStrategy
- Inherits:
-
Object
- Object
- ValkyrieCreateStrategy
- Defined in:
- lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
Overview
Instance Method Summary collapse
-
#initialize ⇒ ValkyrieCreateStrategy
constructor
A new instance of ValkyrieCreateStrategy.
- #result(evaluation) ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize ⇒ ValkyrieCreateStrategy
Returns a new instance of ValkyrieCreateStrategy.
6 7 8 |
# File 'lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb', line 6 def initialize @strategy = FactoryBot.strategy_by_name(:create).new end |
Instance Method Details
#result(evaluation) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb', line 12 def result(evaluation) evaluation.notify(:after_build, evaluation.object) evaluation.notify(:before_create, evaluation.object) result = persister.save(resource: evaluation.object) evaluation.notify(:after_create, result) result end |
#to_sym ⇒ Object
22 23 24 |
# File 'lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb', line 22 def to_sym :valkyrie_create end |