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.0.beta.16 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.15 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.14 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.13 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.12 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.11 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.10 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.9 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.8 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.7 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.6 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.4 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.3 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.2 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.beta.1 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.alpha.4 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.alpha.3 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.alpha.2 spec/derivatives/thumbnail_spec.rb
ddr-models-3.0.0.alpha.1 spec/derivatives/thumbnail_spec.rb