Class: ValkyrieCreateStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb

Overview

Examples:

let(:resource) { FactoryBot.valkyrie_create(:hyrax_work) }

See Also:

Instance Method Summary collapse

Constructor Details

#initializeValkyrieCreateStrategy

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