Sha256: 49db1e1057ec8702fc3e2c365045178ac021ff26c79ca59e863dbd6c61bd69c1

Contents?: true

Size: 1.58 KB

Versions: 19

Compression:

Stored size: 1.58 KB

Contents

module CurationConcerns
  module FactoryHelpers
    module_function

    def load_factories_for(context, klass)
      context.instance_exec(klass) do |curation_concern_class|
        let(:curation_concern_type_underscore) { curation_concern_class.name.underscore }
        let(:default_work_factory_name) { curation_concern_type_underscore }
        let(:default_work_factory_name_with_files) { "#{default_work_factory_name}_with_files".to_sym }
        let(:private_work_factory_name) { "private_#{curation_concern_type_underscore}".to_sym }
        let(:public_work_factory_name) { "public_#{curation_concern_type_underscore}".to_sym }
      end
    end

    def mock_file_factory(opts = {})
      mock_model('MockFile',
                 mime_type:         opts.fetch(:mime_type, 'text/plain'),
                 content:           opts.fetch(:content, 'content'),
                 file_size:         opts.fetch(:file_size, []),
                 format_label:      opts.fetch(:format_label, []),
                 height:            opts.fetch(:height, []),
                 width:             opts.fetch(:width, []),
                 filename:          opts.fetch(:filename, []),
                 well_formed:       opts.fetch(:well_formed, []),
                 page_count:        opts.fetch(:page_count, []),
                 file_title:        opts.fetch(:file_title, []),
                 last_modified:     opts.fetch(:last_modified, []),
                 original_checksum: opts.fetch(:original_checksum, []),
                 digest:            opts.fetch(:digest, [])
                )
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
curation_concerns-1.4.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.3.3 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.3.2 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.3.1 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.3.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.2.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.1.2 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.1.1 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.1.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta10 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta9 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta8 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta7 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta6 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta5 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta4 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta3 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.0.0.beta2 spec/support/curation_concerns/factory_helpers.rb