Sha256: d9fd6eb083b2b7f3fc228c86443a8d9a999d29c7b1d19031589623e57f7e1b2a

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

# Generated via
#  `rails generate curate:work <%= class_name %>`
#
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
  factory :<%= singular_table_name %>, class: <%= class_name %> do
    ignore do
      user { FactoryGirl.create(:user) }
    end

    sequence(:title) {|n| "Title #{n}"}
    rights { Sufia.config.cc_licenses.keys.first.dup }
    date_uploaded { Date.today }
    date_modified { Date.today }
    visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED

    before(:create) { |work, evaluator|
      work.apply_depositor_metadata(evaluator.user.user_key)
      work.contributors << FactoryGirl.create(:person)
    }

    factory :private_<%= singular_table_name %> do
      visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
    end
    factory :public_<%= singular_table_name %> do
      visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
    end

    factory :<%= singular_table_name %>_with_files do
      ignore do
        file_count 3
      end

      after(:create) do |work, evaluator|
        FactoryGirl.create_list(:generic_file, evaluator.file_count, batch: work, user: evaluator.user)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
curate-0.6.6 lib/generators/curate/work/templates/factory.rb.erb
curate-0.6.5 lib/generators/curate/work/templates/factory.rb.erb
curate-0.6.4 lib/generators/curate/work/templates/factory.rb.erb
curate-0.6.3 lib/generators/curate/work/templates/factory.rb.erb
curate-0.6.1 lib/generators/curate/work/templates/factory.rb.erb
curate-0.6.0 lib/generators/curate/work/templates/factory.rb.erb
curate-0.5.6 lib/generators/curate/work/templates/factory.rb.erb
curate-0.5.5 lib/generators/curate/work/templates/factory.rb.erb
curate-0.5.4 lib/generators/curate/work/templates/factory.rb.erb
curate-0.5.2 lib/generators/curate/work/templates/factory.rb.erb