Sha256: 6a78a2fc4f6dbd86de60d800bc38a8a67f6090ae66edd15796bd985925405a35

Contents?: true

Size: 1.23 KB

Versions: 3

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 }
    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

3 entries across 3 versions & 1 rubygems

Version Path
curate-0.5.1 lib/generators/curate/work/templates/factory.rb.erb
curate-0.5.0 lib/generators/curate/work/templates/factory.rb.erb
curate-0.4.2 lib/generators/curate/work/templates/factory.rb.erb