Sha256: 59137524d9835da672a7984cbb99cf5286e1b5c359513331a47f2bf966b04e44

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 KB

Contents

# encoding: utf-8
#FactoryGirl.define do
#  factory :asset_avatar, class: Avatar do |a|
#    #include ActionDispatch::TestProcess
#    a.data File.open('spec/factories/files/rails.png')
#    a.association :assetable, factory: :default_user
#
#    before(:create) do |instance|
#      instance.data_content_type ||= 'image/png'
#    end
#  end
#
#  factory :asset_avatar_big, class: Avatar do |a|
#    a.data File.open('spec/factories/files/silicon_valley.jpg')
#    a.association :assetable, factory: :default_user
#
#    before(:create) do |instance|
#      instance.data_content_type ||= 'image/jpg'
#    end
#  end
#end
# encoding: utf-8
FactoryGirl.define do
  factory :asset_avatar, class: Avatar do
    #include ActionDispatch::TestProcess
    data File.open(File.expand_path('../files/rails.png', __FILE__))
    association :assetable, factory: :default_user

    before(:create) do |instance|
      instance.data_content_type ||= 'image/png'
    end
  end

  factory :asset_avatar_big, class: Avatar do
    data File.open(File.expand_path('../files/silicon_valley.jpg', __FILE__))
    association :assetable, factory: :default_user

    before(:create) do |instance|
      instance.data_content_type ||= 'image/jpg'
    end
  end

  factory :picture do
    data File.open(File.expand_path('../files/rails.png', __FILE__))
    association :assetable, factory: :structure
    is_main true

    before(:create) do |instance|
      instance.data_content_type ||= 'image/jpg'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.3.6 spec/factories/assets.rb
ab_admin-0.3.5 spec/factories/assets.rb
ab_admin-0.3.4 spec/factories/assets.rb
ab_admin-0.3.3 spec/factories/assets.rb
ab_admin-0.3.2 spec/factories/assets.rb
ab_admin-0.3.1 spec/factories/assets.rb
ab_admin-0.3.0 spec/factories/assets.rb