Sha256: 8d3740c147ff1748f5d862ea2278c1e24820b124bd5fb102a2da7c0e3e0427de

Contents?: true

Size: 801 Bytes

Versions: 9

Compression:

Stored size: 801 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 { Hydra::Derivatives::TempfileService.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

9 entries across 9 versions & 1 rubygems

Version Path
hydra-derivatives-3.1.3 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.1.2 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.1.1 spec/services/tempfile_service_spec.rb
hydra-derivatives-1.2.1 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.1.0 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.0.2 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.0.1 spec/services/tempfile_service_spec.rb
hydra-derivatives-3.0.0 spec/services/tempfile_service_spec.rb
hydra-derivatives-2.0.0 spec/services/tempfile_service_spec.rb