Sha256: d619e50a092d6e91105527f60d41e5bfcc2a4b47c125376a8a58ecb0925c941c

Contents?: true

Size: 1.73 KB

Versions: 26

Compression:

Stored size: 1.73 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 a jpeg image' do
          before { allow(object).to receive(:content_type) { 'image/jpeg' } }
          it "should be generatable" do
            expect(subject.generatable?(object)).to be_truthy
          end
        end
        context 'content is neither a tiff nor a jpeg image' do
          before { allow(object).to receive(:content_type) { 'image/gif' } }
          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

26 entries across 26 versions & 1 rubygems

Version Path
ddr-models-3.0.8 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.7 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.6 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.5 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.4 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.3 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.2 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.1 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.rc6 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.rc5 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.rc4 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.rc3 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.rc2 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.rc1 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.22 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.21 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.20 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.18 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.17 spec/derivatives/multires_image_spec.rb