Sha256: 8ba806d1289e6ae35c10571834db7b3d2b7fa6c0289de8985976f0e0e529097e

Contents?: true

Size: 795 Bytes

Versions: 3

Compression:

Stored size: 795 Bytes

Contents

require 'spec_helper'

describe Hydra::Derivatives::TempfileService do
  subject { described_class.new(file) }

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

  describe '#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

3 entries across 3 versions & 1 rubygems

Version Path
hydra-derivatives-3.4.2 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.4.1 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.4.0 spec/services/tempfile_service_spec.rb