Sha256: 92dac2a3caa816fe46772db50377e33ccaf4e21df6f3996d2ed443f85d5fb2f6

Contents?: true

Size: 984 Bytes

Versions: 4

Compression:

Stored size: 984 Bytes

Contents

require 'spec_helper'
require 'stringio'

describe Hydra::Derivatives::IoDecorator do
  let(:file) { StringIO.new('hello') }

  context "with one argument" do
    let(:decorator) { described_class.new(file) }

    describe "#read" do
      subject { decorator.read }

      it { is_expected.to eq 'hello' }
    end
  end

  context "with three arguments" do
    let(:decorator) { described_class.new(file, 'text/plain', 'help.txt') }

    describe "#read" do
      subject { decorator.read }

      it { is_expected.to eq 'hello' }
    end

    describe "mime_type" do
      subject { decorator.mime_type }

      it { is_expected.to eq 'text/plain' }
    end

    describe "original_filename" do
      subject { decorator.original_filename }

      it { is_expected.to eq 'help.txt' }
    end

    describe "original_name" do
      subject { decorator.original_name }

      before { allow(Deprecation).to receive(:warn) }
      it { is_expected.to eq 'help.txt' }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hydra-derivatives-3.5.0 spec/units/io_decorator_spec.rb
hydra-derivatives-3.4.2 spec/units/io_decorator_spec.rb
hydra-derivatives-3.4.1 spec/units/io_decorator_spec.rb
hydra-derivatives-3.4.0 spec/units/io_decorator_spec.rb