Sha256: 0493c9946085aba6d3affd8900b74c09899fb631671c43815ae30452b4b3ea07

Contents?: true

Size: 575 Bytes

Versions: 43

Compression:

Stored size: 575 Bytes

Contents

FactoryBot.define do
  factory :cmor_blog_asset_detail, class: Cmor::Blog::AssetDetail do
    association(:post, factory: :cmor_blog_post)
    after(:build) { |resource| 
      assets = resource.post.assets.attach(
        io:           File.open(File.join(Cmor::Blog::Engine.root.join(*%w( spec files cmor blog asset example.jpg)))),
        filename:     'example.jpg',
        content_type: 'image/jpeg'
      )
      if Rails.version < "6.0.0"
        resource.asset = assets.first
      else
        resource.asset = resource.post.assets.first
      end
    }
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
cmor_blog-0.0.45.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.44.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.43.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.42.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.41.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.40.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.39.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.38.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.37.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.36.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.35.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.34.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.33.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.32.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.31.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.30.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.29.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.28.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.27.pre spec/factories/cmor_blog_asset_details.rb
cmor_blog-0.0.26.pre spec/factories/cmor_blog_asset_details.rb