Sha256: 722b2ca4b89c30207da68f7b5867993ed12e646d1af235ae6c82a912a4ef8a85

Contents?: true

Size: 1.38 KB

Versions: 39

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

module Ddr::Derivatives
  RSpec.describe Thumbnail 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 an image' do
          before { allow(object).to receive(:image?) { true } }
          it "should be generatable" do
            expect(subject.generatable?(object)).to be_truthy
          end
        end
        context 'content is not an image' do
          before { allow(object).to receive(:image?) { false } }
          it "should not be generatable" do
            expect(subject.generatable?(object)).to be_falsey
          end
        end
      end
    end

    describe '.has_derivative?' do
      context 'does not have thumbnail' do
        it 'should not have the derivative' do
          expect(subject.has_derivative?(object)).to be_falsey
        end
      end
      context 'has thumbnail' do
        before { allow(object).to receive(:has_thumbnail?) { true } }
        it 'should have the derivative' do
          expect(subject.has_derivative?(object)).to be_truthy
        end
      end
    end

  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

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