Sha256: bf9e9238d2bf1f8f50870dbbc25f00a5520ff2a64ceca0be9df1915845079ded

Contents?: true

Size: 705 Bytes

Versions: 3

Compression:

Stored size: 705 Bytes

Contents

RSpec.configure do |config|
  config.include FactoryGirl::Syntax::Methods
end

# Use this strategy to get Hash output from factories defined using class: OpenStruct.
# Useful for working with jsonb-based Document objects.
#
# Example usage
#
#  factory :some_document, class: OpenStruct do
#    pulse 37
#  end
#
#  factory :something do
#   document factory: :some_document, strategy: :marshal_dump
#  end
#
class MarshalDumpStrategy
  def initialize
    @strategy = FactoryGirl.strategy_by_name(:create).new
  end

  delegate :association, to: :@strategy

  def result(evaluation)
    @strategy.result(evaluation).marshal_dump
  end
end
FactoryGirl.register_strategy(:marshal_dump, MarshalDumpStrategy)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta9 spec/support/factory_girl.rb
renalware-core-2.0.0.pre.beta8 spec/support/factory_girl.rb
renalware-core-2.0.0.pre.beta7 spec/support/factory_girl.rb