Sha256: b2f8022b8aa0afa9a11834be17e99f5fa919a840ffcc41b31311c100b1a5e2c6

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Github::MimeType do

  let(:object) { Class.new.extend(described_class) }

  context 'lookup' do
    it 'retrieves media type' do
      expect(object.lookup_media('text')).to eql('text+json')
    end

    it 'raises error on unkonwn media type' do
      expect { object.lookup_media('unknown') }.to raise_error(ArgumentError)
    end
  end

  context 'parse' do
    it 'accepts text' do
      expect(object.parse('text')).to eql('application/vnd.github.v3.text+json')
    end

    it 'accepts text+json' do
      expect(object.parse('text+json')).to eql('application/vnd.github.v3.text+json')
    end

    it 'accepts v3.text' do
      expect(object.parse('v3.text')).to eql('application/vnd.github.v3.text+json')
    end

    it 'accepts v3.text+json' do
      expect(object.parse('v3.text+json')).to eql('application/vnd.github.v3.text+json')
    end

    it 'accpets .v3.text' do
      expect(object.parse('.v3.text')).to eql('application/vnd.github.v3.text+json')
    end
  end

end # Github::MimeType

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github_api-0.10.1 spec/github/mime_type_spec.rb
github_api-0.10.0 spec/github/mime_type_spec.rb