Sha256: 03efab45b601295e016b7e014bf655637b5156f69a465db59d2f91114a8e4685

Contents?: true

Size: 1.47 KB

Versions: 13

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

module Ddr::Derivatives
  RSpec.describe MultiresImage do

    subject { described_class }

    let(:object) { Component.new }

    describe '#generatable?' do
      context 'object does not have content' do
        it "should not be generatable" do
          expect(subject.generatable?(object)).to be_falsey
        end
      end
      context 'object has content' do
        before { allow(object).to receive(:has_content?) { true } }
        context 'content is a tiff image' do
          before { allow(object).to receive(:content_type) { 'image/tiff' } }
          it "should be generatable" do
            expect(subject.generatable?(object)).to be_truthy
          end
        end
        context 'content is not a tiff image' do
          before { allow(object).to receive(:content_type) { 'image/jpeg' } }
          it "should not be generatable" do
            expect(subject.generatable?(object)).to be_falsey
          end
        end
      end

      describe '.has_derivative?' do
        context 'does not have multires image' do
          it 'should not have the derivative' do
            expect(subject.has_derivative?(object)).to be_falsey
          end
        end
        context 'has multires image' do
          before { allow(object).to receive(:multires_image_file_path) { '/tmp/foo.ptif' } }
          it 'should have the derivative' do
            expect(subject.has_derivative?(object)).to be_truthy
          end
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ddr-models-3.0.0.beta.10 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.9 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.8 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.7 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.6 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.4 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.3 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.2 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.1 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.alpha.4 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.alpha.3 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.alpha.2 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.alpha.1 spec/derivatives/multires_image_spec.rb