Sha256: 99a0ac64b69062b0b4bf8e63d415a21c126bc4139bd96dbd2d97e377089bf14e

Contents?: true

Size: 1.99 KB

Versions: 66

Compression:

Stored size: 1.99 KB

Contents

require 'spec_helper'

describe CurationConcerns::FileSetHelper do
  describe '#media_display' do
    let(:file_set) { SolrDocument.new(mime_type_ssi: mime_type) }
    let(:mime_type) { 'image/tiff' }

    before do
      allow(helper).to receive(:media_display_partial).with(file_set)
        .and_return('curation_concerns/file_sets/media_display/image')
    end

    it "renders a partial" do
      expect(helper).to receive(:render)
        .with('curation_concerns/file_sets/media_display/image', file_set: file_set)
      helper.media_display(file_set)
    end

    it "takes options" do
      expect(helper).to receive(:render)
        .with('curation_concerns/file_sets/media_display/image', file_set: file_set, transcript_id: '123')
      helper.media_display(file_set, transcript_id: '123')
    end
  end

  describe '#media_display_partial' do
    subject { helper.media_display_partial(file_set) }

    let(:file_set) { SolrDocument.new(mime_type_ssi: mime_type) }

    context "with an image" do
      let(:mime_type) { 'image/tiff' }
      it { is_expected.to eq 'curation_concerns/file_sets/media_display/image' }
    end

    context "with a video" do
      let(:mime_type) { 'video/webm' }
      it { is_expected.to eq 'curation_concerns/file_sets/media_display/video' }
    end

    context "with an audio" do
      let(:mime_type) { 'audio/wav' }
      it { is_expected.to eq 'curation_concerns/file_sets/media_display/audio' }
    end

    context "with a pdf" do
      let(:mime_type) { 'application/pdf' }
      it { is_expected.to eq 'curation_concerns/file_sets/media_display/pdf' }
    end

    context "with a word document" do
      let(:mime_type) { 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }
      it { is_expected.to eq 'curation_concerns/file_sets/media_display/office_document' }
    end

    context "with anything else" do
      let(:mime_type) { 'application/binary' }
      it { is_expected.to eq 'curation_concerns/file_sets/media_display/default' }
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
curation_concerns-1.3.2 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.3.1 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.3.0 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.2.0 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.1.2 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.1.1 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.1.0 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta10 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta9 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta8 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta7 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta6 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta5 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta4 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta3 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta2 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-1.0.0.beta1 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-0.14.0 spec/helpers/curation_concerns/file_set_helper_spec.rb
curation_concerns-0.14.0.pre4 spec/helpers/curation_concerns/file_set_helper_spec.rb