forked from piotrmurach/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmime_type_spec.rb
More file actions
41 lines (30 loc) · 1.03 KB
/
mime_type_spec.rb
File metadata and controls
41 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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