Sha256: afde2075d5f49084b58f0db05420f3abf42da777ec950a90acd814ac2f93bfbe

Contents?: true

Size: 886 Bytes

Versions: 4

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

class TestObject < ActiveFedora::Base
  attr_accessor :source_file_name
end

describe Hydra::Derivatives::RemoteSourceFile do
  describe '.call' do
    let(:file_name) { 'my_source_file.mp4' }

    context 'when you pass in a String file name' do
      let(:input_obj) { file_name }
      let(:options) { {} }

      it 'yields the file name' do
        expect do |blk|
          described_class.call(input_obj, options, &blk)
        end.to yield_with_args(file_name)
      end
    end

    context 'when you pass in an ActiveFedora::Base object ' do
      let(:input_obj) { TestObject.new(source_file_name: file_name) }
      let(:options) { { source: :source_file_name } }

      it 'yields the file name' do
        expect do |blk|
          described_class.call(input_obj, options, &blk)
        end.to yield_with_args(file_name)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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