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.0.beta.16 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.15 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.14 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.13 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.12 spec/derivatives/multires_image_spec.rb
ddr-models-3.0.0.beta.11 spec/derivatives/multires_image_spec.rb