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
70 lines (55 loc) · 2.55 KB
/
mime_type_spec.rb
File metadata and controls
70 lines (55 loc) · 2.55 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
require 'spec_helper'
describe Github::MimeType do
let(:github) { Github.new }
it "should lookup mime type for :full" do
github.lookup_mime(:full).should == 'full+json'
end
it "should lookup mime type for :html" do
github.lookup_mime(:html).should == 'html+json'
end
it "should lookup mime type for :html" do
github.lookup_mime(:text).should == 'text+json'
end
it "should lookup mime type for :raw" do
github.lookup_mime(:raw).should == 'raw+json'
end
it "should default to json if no parameters given" do
Github.should_receive(:parse).and_return 'application/json'
Github.parse.should == 'application/json'
end
it "should accept header for 'issue' request" do
Github.should_receive(:parse).with(:issue, :full).
and_return 'application/vnd.github-issue.full+json'
Github.parse(:issue, :full).should == 'application/vnd.github-issue.full+json'
end
it "should accept header for 'isssue comment' request" do
Github.should_receive(:parse).with(:issue_comment, :full).
and_return 'application/vnd.github-issuecomment.full+json'
Github.parse(:issue_comment, :full).should == 'application/vnd.github-issuecomment.full+json'
end
it "should accept header for 'commit comment' request" do
Github.should_receive(:parse).with(:commit_comment, :full).
and_return 'application/vnd.github-commitcomment.full+json'
Github.parse(:commit_comment, :full).should == 'application/vnd.github-commitcomment.full+json'
end
it "should accept header for 'pull requst' request" do
Github.should_receive(:parse).with(:pull_request, :full).
and_return 'application/vnd.github-pull.full+json'
Github.parse(:pull_request, :full).should == 'application/vnd.github-pull.full+json'
end
it "should accept header for 'pull comment' request" do
Github.should_receive(:parse).with(:pull_comment, :full).
and_return 'application/vnd.github-pullcomment.full+json'
Github.parse(:pull_comment, :full).should == 'application/vnd.github-pullcomment.full+json'
end
it "should accept header for 'gist comment' request" do
Github.should_receive(:parse).with(:gist_comment, :full).
and_return 'application/vnd.github-gistcomment.full+json'
Github.parse(:gist_comment, :full).should == 'application/vnd.github-gistcomment.full+json'
end
it "should accept header for 'blog' request" do
Github.should_receive(:parse).with(:blob, :blob).
and_return 'application/vnd.github-blob.raw'
Github.parse(:blob, :blob).should == 'application/vnd.github-blob.raw'
end
end # Github::MimeType