Sha256: 4fb28c47e1188f2aab9c8f197f44df9966b9335d734129010be09507468b0f1a

Contents?: true

Size: 1.7 KB

Versions: 18

Compression:

Stored size: 1.7 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, []),
                 duration:          opts.fetch(:duration, []),
                 sample_rate:       opts.fetch(:sample_rate, [])
                )
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.7 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-2.0.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-2.0.0.rc2 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.6 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.5 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.4 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.3 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.2 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-2.0.0.rc1 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.1 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.7.0.beta1 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.6.3 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.6.2 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.6.1 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.6.0 spec/support/curation_concerns/factory_helpers.rb
curation_concerns-1.5.0 spec/support/curation_concerns/factory_helpers.rb