Sha256: 17867e9a63a97eaa57830d0f48232ba216dc20e3d14eca8a37a919ae5b0258a8

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8

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

9 entries across 9 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/mime_type_spec.rb
github_api-0.12.2 spec/github/mime_type_spec.rb
github_api-0.12.1 spec/github/mime_type_spec.rb
github_api-0.12.0 spec/github/mime_type_spec.rb
github_api-0.11.3 spec/github/mime_type_spec.rb
github_api-0.11.2 spec/github/mime_type_spec.rb
github_api-0.11.1 spec/github/mime_type_spec.rb
github_api-0.11.0 spec/github/mime_type_spec.rb
github_api-0.10.2 spec/github/mime_type_spec.rb