Sha256: 3d27ce8d1cda54c9d99b570a040e09d5fbc8974ce17339cf7bb72da12e9a5c02

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe Hydra::Derivatives::Image do
  let(:object) { ActiveFedora::Base.new }
  describe "when arguments are passed as a string" do
    let(:directives) {{ :thumb => "100x100>" } }
    subject { Hydra::Derivatives::Image.new(object, 'content', directives)}

    it "should use the string as the size and the name is autogenerated" do
      expect(subject).to receive(:create_resized_image).with(an_instance_of(ActiveFedora::Datastream), "100x100>", 'png') do |ds|
        expect(ds.dsid).to eq('content_thumb')
      end
      subject.process
    end
  end
  describe "when arguments are passed as a hash" do
    let(:directives) {{ :thumb => {size: "200x300>", datastream: 'thumbnail'} }}
    subject { Hydra::Derivatives::Image.new(object, 'content', directives)}
    it "should use the specified size and name" do
      expect(subject).to receive(:create_resized_image).with(an_instance_of(ActiveFedora::Datastream), "200x300>", 'png') do |ds|
        expect(ds.dsid).to eq('thumbnail')
      end
      subject.process

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hydra-derivatives-0.1.1 spec/units/image_spec.rb