Sha256: 83005969ca7bdf1632b40cb45880119df11482b09505c44f619d381c5583add9

Contents?: true

Size: 793 Bytes

Versions: 7

Compression:

Stored size: 793 Bytes

Contents

require 'spec_helper'

describe Hydra::Derivatives::TempfileService do
  let(:class_with_metadata_extraction) do
    Class.new do
      attr_reader :content, :mime_type, :uri

      def initialize(options = {})
        @content = options.fetch(:content, '')
        @mime_uype = options.fetch(:mime_type, nil)
        @uri = 'http://example.com/pid/123'
      end

      def has_content?
        content.present?
      end
    end
  end

  let(:initialization_options) { { content: 'abc', mime_type: 'text/plain' } }

  let(:file) { class_with_metadata_extraction.new(initialization_options) }

  subject { described_class.new(file) }
  context '#tempfile' do
    it 'has a method called to_tempfile' do
      expect { |b| subject.tempfile(&b) }.to yield_with_args(Tempfile)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hydra-derivatives-3.3.2 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.3.1 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.3.0 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.2.2 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.2.1 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.2.0 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.1.4 spec/services/tempfile_service_spec.rb