Sha256: 01c0f1b78d9a7f0a95cd958637077a66f7e9a7f77ebed12f5ff2ef683831d18a

Contents?: true

Size: 661 Bytes

Versions: 4

Compression:

Stored size: 661 Bytes

Contents

require 'spec_helper'
module Alf
  describe Reader, ".by_mime_type" do

    let(:io){ StringIO.new("") }

    context 'when mime type is unrecognized' do
      subject{
        Reader.by_mime_type("no/suchone", io)
      }

      it 'should raise an error' do
        lambda{
          subject
        }.should raise_error(UnsupportedMimeTypeError, /No reader for `no\/suchone`/)
      end
    end

    context 'when such mime type is registered' do
      subject{
        Reader.by_mime_type("text/csv", io)
      }

      it{ should be_a(Reader::CSV) }

      it 'should be wired correctly' do
        subject.input.should be(io)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-io/reader/class/test_by_mime_type.rb
alf-core-0.14.0 spec/unit/alf-io/reader/class/test_by_mime_type.rb
alf-core-0.13.1 spec/unit/alf-io/reader/class/test_by_mime_type.rb
alf-core-0.13.0 spec/unit/alf-io/reader/class/test_by_mime_type.rb