Sha256: 98eef76f76cd82e09b5b6a047d907954229bd25f04f068fdef33a7f7fb720b2c

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Hydra::Derivatives do
  before(:all) do
    class CustomFile < ActiveFedora::Base
      include Hydra::Derivatives
    end
    class CustomProcessor < Hydra::Derivatives::Processors::Processor
    end
    class CustomSourceFileService
    end
    class CustomOutputFileService
    end
  end

  after(:all)  do
    Object.send(:remove_const, :CustomFile)
    Object.send(:remove_const, :CustomProcessor)
    Object.send(:remove_const, :CustomSourceFileService)
    Object.send(:remove_const, :CustomOutputFileService)
  end

  describe "source_file_service" do
    let(:custom_source_file_service) { "fake service" }
    before do
      allow(Hydra::Derivatives).to receive(:source_file_service).and_return(custom_source_file_service)
    end
    subject { Class.new { include Hydra::Derivatives } }

    context "as a global configuration setting" do
      it "utilizes the default source file service" do
        expect(subject.source_file_service).to eq(custom_source_file_service)
      end
    end

    context "as an instance level configuration setting" do
      let(:another_custom_source_file_service) { "another fake service" }
      subject { Class.new { include Hydra::Derivatives }.new }
      before { subject.source_file_service = another_custom_source_file_service }

      it "accepts a custom source file service as an option" do
        expect(subject.source_file_service).to eq(another_custom_source_file_service)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hydra-derivatives-3.1.3 spec/units/derivatives_spec.rb
hydra-derivatives-3.1.2 spec/units/derivatives_spec.rb
hydra-derivatives-3.1.1 spec/units/derivatives_spec.rb
hydra-derivatives-3.1.0 spec/units/derivatives_spec.rb
hydra-derivatives-3.0.2 spec/units/derivatives_spec.rb
hydra-derivatives-3.0.1 spec/units/derivatives_spec.rb
hydra-derivatives-3.0.0 spec/units/derivatives_spec.rb