github_api 0.8.9 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/github_api/gists/comments.rb +0 -5
- data/lib/github_api/git_data/references.rb +1 -1
- data/lib/github_api/version.rb +1 -1
- data/spec/github/gists/comments/create_spec.rb +51 -0
- data/spec/github/gists/comments/delete_spec.rb +32 -0
- data/spec/github/gists/comments/edit_spec.rb +52 -0
- data/spec/github/gists/comments/get_spec.rb +48 -0
- data/spec/github/gists/comments/list_spec.rb +51 -0
- data/spec/github/gists/comments_spec.rb +2 -247
- data/spec/github/gists/gists_spec.rb +4 -0
- data/spec/github/git_data/references/list_spec.rb +38 -4
- metadata +37 -32
@@ -22,7 +22,6 @@ module Github
|
|
22
22
|
def list(gist_id, params={})
|
23
23
|
normalize! params
|
24
24
|
assert_presence_of gist_id
|
25
|
-
# _merge_mime_type(:gist_comment, params)
|
26
25
|
|
27
26
|
response = get_request("/gists/#{gist_id}/comments", params)
|
28
27
|
return response unless block_given?
|
@@ -39,7 +38,6 @@ module Github
|
|
39
38
|
def get(gist_id, comment_id, params={})
|
40
39
|
normalize! params
|
41
40
|
assert_presence_of comment_id
|
42
|
-
# _merge_mime_type(:gist_comment, params)
|
43
41
|
|
44
42
|
get_request("/gists/#{gist_id}/comments/#{comment_id}", params)
|
45
43
|
end
|
@@ -53,7 +51,6 @@ module Github
|
|
53
51
|
#
|
54
52
|
def create(gist_id, params={})
|
55
53
|
normalize! params
|
56
|
-
# _merge_mime_type(:gist_comment, params)
|
57
54
|
filter! VALID_GIST_COMMENT_OPTIONS, params
|
58
55
|
assert_required_keys(REQUIRED_GIST_COMMENT_OPTIONS, params)
|
59
56
|
|
@@ -69,7 +66,6 @@ module Github
|
|
69
66
|
def edit(gist_id, comment_id, params={})
|
70
67
|
normalize! params
|
71
68
|
assert_presence_of comment_id
|
72
|
-
# _merge_mime_type(:gist_comment, params)
|
73
69
|
filter! VALID_GIST_COMMENT_OPTIONS, params
|
74
70
|
assert_required_keys(REQUIRED_GIST_COMMENT_OPTIONS, params)
|
75
71
|
|
@@ -85,7 +81,6 @@ module Github
|
|
85
81
|
def delete(gist_id, comment_id, params={})
|
86
82
|
normalize! params
|
87
83
|
assert_presence_of comment_id
|
88
|
-
# _merge_mime_type(:gist_comment, params)
|
89
84
|
|
90
85
|
delete_request("/gists/#{gist_id}/comments/#{comment_id}", params)
|
91
86
|
end
|
@@ -131,7 +131,7 @@ module Github
|
|
131
131
|
private
|
132
132
|
|
133
133
|
def validate_reference ref
|
134
|
-
refs = ref.
|
134
|
+
refs = ref.start_with?('ref/') ? ref : "refs/#{ref}"
|
135
135
|
unless VALID_REF_PARAM_VALUES['ref'] =~ refs
|
136
136
|
raise ArgumentError, "Provided 'reference' is invalid"
|
137
137
|
end
|
data/lib/github_api/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Github::Gists::Comments, '#create' do
|
6
|
+
let(:gist_id) { 1 }
|
7
|
+
let(:request_path) { "/gists/#{gist_id}/comments" }
|
8
|
+
let(:inputs) {
|
9
|
+
{ "body" =>"Just commenting for the sake of commenting",
|
10
|
+
"unrelated" => true }
|
11
|
+
}
|
12
|
+
|
13
|
+
before {
|
14
|
+
stub_post(request_path).with(inputs.except('unrelated')).
|
15
|
+
to_return(:body => body, :status => status,
|
16
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
17
|
+
}
|
18
|
+
|
19
|
+
after { reset_authentication_for(subject) }
|
20
|
+
|
21
|
+
context "resouce created" do
|
22
|
+
let(:body) { fixture('gists/comment.json') }
|
23
|
+
let(:status) { 201 }
|
24
|
+
|
25
|
+
it "should fail to create resource if 'content' input is missing" do
|
26
|
+
expect {
|
27
|
+
subject.create gist_id, inputs.except('body')
|
28
|
+
}.to raise_error(Github::Error::RequiredParams)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should create resource successfully" do
|
32
|
+
subject.create gist_id, inputs
|
33
|
+
a_post(request_path).with(inputs).should have_been_made
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return the resource" do
|
37
|
+
comment = subject.create gist_id, inputs
|
38
|
+
comment.should be_a Hashie::Mash
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should get the comment information" do
|
42
|
+
comment = subject.create gist_id, inputs
|
43
|
+
comment.user.login.should == 'octocat'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it_should_behave_like 'request failure' do
|
48
|
+
let(:requestable) { subject.create gist_id, inputs }
|
49
|
+
end
|
50
|
+
|
51
|
+
end # create
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Github::Gists::Comments, '#delete' do
|
6
|
+
let(:gist_id) { 1 }
|
7
|
+
let(:comment_id) { 1 }
|
8
|
+
let(:request_path) { "/gists/#{gist_id}/comments/#{comment_id}" }
|
9
|
+
let(:body) { '' }
|
10
|
+
let(:status) { 204 }
|
11
|
+
|
12
|
+
before {
|
13
|
+
stub_delete(request_path).to_return(:body => body, :status => status,
|
14
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
15
|
+
}
|
16
|
+
|
17
|
+
after { reset_authentication_for(subject) }
|
18
|
+
|
19
|
+
it "should fail to create resource if 'content' input is missing" do
|
20
|
+
expect { subject.delete gist_id, nil }.to raise_error(ArgumentError)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should create resource successfully" do
|
24
|
+
subject.delete gist_id, comment_id
|
25
|
+
a_delete(request_path).should have_been_made
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like 'request failure' do
|
29
|
+
let(:requestable) { subject.delete gist_id, comment_id }
|
30
|
+
end
|
31
|
+
|
32
|
+
end # delete
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Github::Gists::Comments, '#create' do
|
6
|
+
let(:gist_id) { 1 }
|
7
|
+
let(:comment_id) { 1 }
|
8
|
+
let(:request_path) { "/gists/#{gist_id}/comments/#{comment_id}" }
|
9
|
+
let(:inputs) {
|
10
|
+
{ "body" =>"Just commenting for the sake of commenting",
|
11
|
+
"unrelated" => true }
|
12
|
+
}
|
13
|
+
|
14
|
+
before {
|
15
|
+
stub_patch(request_path).with(inputs.except('unrelated')).
|
16
|
+
to_return(:body => body, :status => status,
|
17
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
18
|
+
}
|
19
|
+
|
20
|
+
after { reset_authentication_for(subject) }
|
21
|
+
|
22
|
+
context "resouce edited" do
|
23
|
+
let(:status) { 201 }
|
24
|
+
let(:body) { fixture('gists/comment.json') }
|
25
|
+
|
26
|
+
it "should fail to create resource if 'content' input is missing" do
|
27
|
+
expect {
|
28
|
+
subject.edit gist_id, comment_id, inputs.except('body')
|
29
|
+
}.to raise_error(Github::Error::RequiredParams)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should create resource successfully" do
|
33
|
+
subject.edit gist_id, comment_id, inputs
|
34
|
+
a_patch(request_path).with(inputs).should have_been_made
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should return the resource" do
|
38
|
+
comment = subject.edit gist_id, comment_id, inputs
|
39
|
+
comment.should be_a Hashie::Mash
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should get the comment information" do
|
43
|
+
comment = subject.edit gist_id, comment_id, inputs
|
44
|
+
comment.user.login.should == 'octocat'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it_should_behave_like 'request failure' do
|
49
|
+
let(:requestable) { subject.edit gist_id, comment_id, inputs }
|
50
|
+
end
|
51
|
+
|
52
|
+
end # edit
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Github::Gists::Comments, '#get' do
|
6
|
+
let(:gist_id) { 1 }
|
7
|
+
let(:comment_id) { 1 }
|
8
|
+
let(:request_path) { "/gists/#{gist_id}/comments/#{comment_id}" }
|
9
|
+
|
10
|
+
before {
|
11
|
+
stub_get(request_path).to_return(:body => body, :status => status,
|
12
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
13
|
+
}
|
14
|
+
|
15
|
+
after { reset_authentication_for(subject) }
|
16
|
+
|
17
|
+
context 'resource found' do
|
18
|
+
let(:body) { fixture('gists/comment.json') }
|
19
|
+
let(:status) { 200 }
|
20
|
+
|
21
|
+
it { should respond_to :find }
|
22
|
+
|
23
|
+
it "should fail to get resource without comment id" do
|
24
|
+
expect { subject.get nil, nil }.to raise_error(ArgumentError)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should get the resource" do
|
28
|
+
subject.get gist_id, comment_id
|
29
|
+
a_get(request_path).should have_been_made
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should get comment information" do
|
33
|
+
comment = subject.get gist_id, comment_id
|
34
|
+
comment.id.should eq comment_id
|
35
|
+
comment.user.login.should == 'octocat'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should return mash" do
|
39
|
+
comment = subject.get gist_id, comment_id
|
40
|
+
comment.should be_a Hashie::Mash
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it_should_behave_like 'request failure' do
|
45
|
+
let(:requestable) { subject.get gist_id, comment_id }
|
46
|
+
end
|
47
|
+
|
48
|
+
end # get
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Github::Gists::Comments, '#list' do
|
6
|
+
let(:gist_id) { 1 }
|
7
|
+
let(:request_path) { "/gists/#{gist_id}/comments" }
|
8
|
+
|
9
|
+
before {
|
10
|
+
stub_get(request_path).to_return(:body => body, :status => status,
|
11
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
12
|
+
}
|
13
|
+
|
14
|
+
after { reset_authentication_for(subject) }
|
15
|
+
|
16
|
+
context 'resource found' do
|
17
|
+
let(:body) { fixture('gists/comments.json') }
|
18
|
+
let(:status) { 200 }
|
19
|
+
|
20
|
+
it { should respond_to :all }
|
21
|
+
|
22
|
+
it "throws error if gist id not provided" do
|
23
|
+
expect { subject.list nil}.to raise_error(ArgumentError)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should get the resources" do
|
27
|
+
subject.list gist_id
|
28
|
+
a_get(request_path).should have_been_made
|
29
|
+
end
|
30
|
+
|
31
|
+
it_should_behave_like 'an array of resources' do
|
32
|
+
let(:requestable) { subject.list gist_id }
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should get gist information" do
|
36
|
+
comments = subject.list gist_id
|
37
|
+
comments.first.user.login.should == 'octocat'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should yield to a block" do
|
41
|
+
yielded = []
|
42
|
+
result = subject.list(gist_id) { |obj| yielded << obj }
|
43
|
+
yielded.should == result
|
44
|
+
end
|
45
|
+
|
46
|
+
it_should_behave_like 'an array of resources' do
|
47
|
+
let(:requestable) { subject.list gist_id }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end # list
|
@@ -3,254 +3,9 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Github::Gists::Comments do
|
6
|
-
let(:github) { Github.new }
|
7
|
-
let(:gist_id) { '1' }
|
8
|
-
let(:comment_id) { 1 }
|
9
6
|
|
10
|
-
after { reset_authentication_for
|
7
|
+
after { reset_authentication_for subject }
|
11
8
|
|
12
|
-
|
13
|
-
it { github.gists.comments.should respond_to :all }
|
14
|
-
|
15
|
-
context 'resource found' do
|
16
|
-
before do
|
17
|
-
stub_get("/gists/#{gist_id}/comments").
|
18
|
-
to_return(:body => fixture('gists/comments.json'),
|
19
|
-
:status => 200,
|
20
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
21
|
-
end
|
22
|
-
|
23
|
-
it "throws error if gist id not provided" do
|
24
|
-
expect { github.gists.comments.list nil}.to raise_error(ArgumentError)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should get the resources" do
|
28
|
-
github.gists.comments.list gist_id
|
29
|
-
a_get("/gists/#{gist_id}/comments").should have_been_made
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should return array of resources" do
|
33
|
-
comments = github.gists.comments.list gist_id
|
34
|
-
comments.should be_an Array
|
35
|
-
comments.should have(1).items
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should be a mash type" do
|
39
|
-
comments = github.gists.comments.list gist_id
|
40
|
-
comments.first.should be_a Hashie::Mash
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should get gist information" do
|
44
|
-
comments = github.gists.comments.list gist_id
|
45
|
-
comments.first.user.login.should == 'octocat'
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should yield to a block" do
|
49
|
-
github.gists.comments.should_receive(:list).with(gist_id).and_yield('web')
|
50
|
-
github.gists.comments.list(gist_id) { |param| 'web' }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'resource not found' do
|
55
|
-
before do
|
56
|
-
stub_get("/gists/#{gist_id}/comments").
|
57
|
-
to_return(:body => "", :status => [404, "Not Found"])
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should return 404 with a message 'Not Found'" do
|
61
|
-
expect {
|
62
|
-
github.gists.comments.list gist_id
|
63
|
-
}.to raise_error(Github::Error::NotFound)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end # list
|
67
|
-
|
68
|
-
describe "#get" do
|
69
|
-
it { github.gists.should respond_to :find }
|
70
|
-
|
71
|
-
context 'resource found' do
|
72
|
-
before do
|
73
|
-
stub_get("/gists/#{gist_id}/comments/#{comment_id}").
|
74
|
-
to_return(:body => fixture('gists/comment.json'),
|
75
|
-
:status => 200,
|
76
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should fail to get resource without comment id" do
|
80
|
-
expect { github.gists.comments.get nil, nil }.to raise_error(ArgumentError)
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should get the resource" do
|
84
|
-
github.gists.comments.get gist_id, comment_id
|
85
|
-
a_get("/gists/#{gist_id}/comments/#{comment_id}").should have_been_made
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should get comment information" do
|
89
|
-
comment = github.gists.comments.get gist_id, comment_id
|
90
|
-
comment.id.should eq comment_id
|
91
|
-
comment.user.login.should == 'octocat'
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should return mash" do
|
95
|
-
comment = github.gists.comments.get gist_id, comment_id
|
96
|
-
comment.should be_a Hashie::Mash
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
context 'resource not found' do
|
101
|
-
before do
|
102
|
-
stub_get("/gists/#{gist_id}/comments/#{comment_id}").
|
103
|
-
to_return(:body => fixture('gists/comment.json'),
|
104
|
-
:status => 404,
|
105
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should fail to retrive resource" do
|
109
|
-
expect {
|
110
|
-
github.gists.comments.get gist_id, comment_id
|
111
|
-
}.to raise_error(Github::Error::NotFound)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end # get
|
115
|
-
|
116
|
-
describe "#create" do
|
117
|
-
let(:inputs) {
|
118
|
-
{ "body" =>"Just commenting for the sake of commenting",
|
119
|
-
"unrelated" => true }
|
120
|
-
}
|
121
|
-
|
122
|
-
context "resouce created" do
|
123
|
-
before do
|
124
|
-
stub_post("/gists/#{gist_id}/comments").
|
125
|
-
with(inputs.except('unrelated')).
|
126
|
-
to_return(:body => fixture('gists/comment.json'),
|
127
|
-
:status => 201,
|
128
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
129
|
-
end
|
130
|
-
|
131
|
-
it "should fail to create resource if 'content' input is missing" do
|
132
|
-
expect {
|
133
|
-
github.gists.comments.create gist_id, inputs.except('body')
|
134
|
-
}.to raise_error(Github::Error::RequiredParams)
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should create resource successfully" do
|
138
|
-
github.gists.comments.create gist_id, inputs
|
139
|
-
a_post("/gists/#{gist_id}/comments").with(inputs).should have_been_made
|
140
|
-
end
|
141
|
-
|
142
|
-
it "should return the resource" do
|
143
|
-
comment = github.gists.comments.create gist_id, inputs
|
144
|
-
comment.should be_a Hashie::Mash
|
145
|
-
end
|
146
|
-
|
147
|
-
it "should get the comment information" do
|
148
|
-
comment = github.gists.comments.create gist_id, inputs
|
149
|
-
comment.user.login.should == 'octocat'
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
context "failed to create resource" do
|
154
|
-
before do
|
155
|
-
stub_post("/gists/#{gist_id}/comments").with(inputs).
|
156
|
-
to_return(:body => fixture('gists/comment.json'),
|
157
|
-
:status => 404,
|
158
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
159
|
-
end
|
160
|
-
|
161
|
-
it "should faile to retrieve resource" do
|
162
|
-
expect {
|
163
|
-
github.gists.comments.create gist_id, inputs
|
164
|
-
}.to raise_error(Github::Error::NotFound)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end # create
|
168
|
-
|
169
|
-
describe "#edit" do
|
170
|
-
let(:inputs) {
|
171
|
-
{ "body" =>"Just commenting for the sake of commenting", "unrelated" => true }
|
172
|
-
}
|
173
|
-
|
174
|
-
context "resouce edited" do
|
175
|
-
before do
|
176
|
-
stub_patch("/gists/#{gist_id}/comments/#{comment_id}").
|
177
|
-
with(inputs.except('unrelated')).
|
178
|
-
to_return(:body => fixture('gists/comment.json'),
|
179
|
-
:status => 201,
|
180
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
181
|
-
end
|
182
|
-
|
183
|
-
it "should fail to create resource if 'content' input is missing" do
|
184
|
-
expect {
|
185
|
-
github.gists.comments.edit gist_id, comment_id, inputs.except('body')
|
186
|
-
}.to raise_error(Github::Error::RequiredParams)
|
187
|
-
end
|
188
|
-
|
189
|
-
it "should create resource successfully" do
|
190
|
-
github.gists.comments.edit gist_id, comment_id, inputs
|
191
|
-
a_patch("/gists/#{gist_id}/comments/#{comment_id}").with(inputs).should have_been_made
|
192
|
-
end
|
193
|
-
|
194
|
-
it "should return the resource" do
|
195
|
-
comment = github.gists.comments.edit gist_id, comment_id, inputs
|
196
|
-
comment.should be_a Hashie::Mash
|
197
|
-
end
|
198
|
-
|
199
|
-
it "should get the comment information" do
|
200
|
-
comment = github.gists.comments.edit gist_id, comment_id, inputs
|
201
|
-
comment.user.login.should == 'octocat'
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
context "failed to create resource" do
|
206
|
-
before do
|
207
|
-
stub_patch("/gists/#{gist_id}/comments/#{comment_id}").with(inputs).
|
208
|
-
to_return(:body => fixture('gists/comment.json'),
|
209
|
-
:status => 404,
|
210
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
211
|
-
end
|
212
|
-
|
213
|
-
it "should faile to retrieve resource" do
|
214
|
-
expect {
|
215
|
-
github.gists.comments.edit gist_id, comment_id, inputs
|
216
|
-
}.to raise_error(Github::Error::NotFound)
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end # edit
|
220
|
-
|
221
|
-
describe "#delete" do
|
222
|
-
context "resouce deleted" do
|
223
|
-
before do
|
224
|
-
stub_delete("/gists/#{gist_id}/comments/#{comment_id}").
|
225
|
-
to_return(:body => '',
|
226
|
-
:status => 204,
|
227
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
228
|
-
end
|
229
|
-
|
230
|
-
it "should fail to create resource if 'content' input is missing" do
|
231
|
-
expect { github.gists.comments.delete gist_id, nil }.to raise_error(ArgumentError)
|
232
|
-
end
|
233
|
-
|
234
|
-
it "should create resource successfully" do
|
235
|
-
github.gists.comments.delete gist_id, comment_id
|
236
|
-
a_delete("/gists/#{gist_id}/comments/#{comment_id}").should have_been_made
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
context "failed to create resource" do
|
241
|
-
before do
|
242
|
-
stub_delete("/gists/#{gist_id}/comments/#{comment_id}").
|
243
|
-
to_return(:body => fixture('gists/comment.json'),
|
244
|
-
:status => 404,
|
245
|
-
:headers => {:content_type => "application/json; charset=utf-8"})
|
246
|
-
end
|
247
|
-
|
248
|
-
it "should faile to retrieve resource" do
|
249
|
-
expect {
|
250
|
-
github.gists.comments.delete gist_id, comment_id
|
251
|
-
}.to raise_error(Github::Error::NotFound)
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end # delete
|
9
|
+
it_should_behave_like 'api interface'
|
255
10
|
|
256
11
|
end # Github::Gists::Comments
|
@@ -25,10 +25,44 @@ describe Github::GitData::References, '#list' do
|
|
25
25
|
expect { subject.list nil, repo }.to raise_error(ArgumentError)
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
context 'with invalid reference' do
|
29
|
+
let(:ref) { '/branch/featureA' }
|
30
|
+
|
31
|
+
it "should fail to call" do
|
32
|
+
expect {
|
33
|
+
subject.list user, repo, :ref => ref
|
34
|
+
}.to raise_error(ArgumentError)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'with valid reference' do
|
39
|
+
let(:ref) { 'heads/lleger-refactor' }
|
40
|
+
|
41
|
+
it "should pass with valid reference" do
|
42
|
+
expect {
|
43
|
+
subject.list user, repo, :ref => ref
|
44
|
+
}.to_not raise_error(ArgumentError)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'with valid reference and refs branch name' do
|
49
|
+
let(:ref) { 'refactors/lleger-refactor' }
|
50
|
+
|
51
|
+
it "should pass with valid reference" do
|
52
|
+
expect {
|
53
|
+
subject.list user, repo, :ref => ref
|
54
|
+
}.to_not raise_error(ArgumentError)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with valid renference and refs' do
|
59
|
+
let(:ref) { 'refs/heads/lleger-refactor' }
|
60
|
+
|
61
|
+
it "should pass with valid reference" do
|
62
|
+
expect {
|
63
|
+
subject.list user, repo, :ref => ref
|
64
|
+
}.to_not raise_error(ArgumentError)
|
65
|
+
end
|
32
66
|
end
|
33
67
|
|
34
68
|
it "should get the resources" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &2154520100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2154520100
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154519600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154519600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2154519140 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154519140
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: oauth2
|
49
|
-
requirement: &
|
49
|
+
requirement: &2154518760 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154518760
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &2154518220 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.5.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2154518220
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &2154517720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2154517720
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: cucumber
|
82
|
-
requirement: &
|
82
|
+
requirement: &2154517260 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2154517260
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: webmock
|
93
|
-
requirement: &
|
93
|
+
requirement: &2154516800 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.9.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2154516800
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: vcr
|
104
|
-
requirement: &
|
104
|
+
requirement: &2154516340 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 2.4.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2154516340
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: simplecov
|
115
|
-
requirement: &
|
115
|
+
requirement: &2154515880 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 0.7.1
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2154515880
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: guard
|
126
|
-
requirement: &
|
126
|
+
requirement: &2154515500 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *2154515500
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: guard-rspec
|
137
|
-
requirement: &
|
137
|
+
requirement: &2154515040 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *2154515040
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: guard-cucumber
|
148
|
-
requirement: &
|
148
|
+
requirement: &2154510760 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *2154510760
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: rake
|
159
|
-
requirement: &
|
159
|
+
requirement: &2154510340 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *2154510340
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: bundler
|
170
|
-
requirement: &
|
170
|
+
requirement: &2154509920 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,7 +175,7 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *2154509920
|
179
179
|
description: ! ' Ruby wrapper that supports all of the GitHub API v3 methods(nearly
|
180
180
|
200). It''s build in a modular way, that is, you can either instantiate the whole
|
181
181
|
api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely
|
@@ -589,6 +589,11 @@ files:
|
|
589
589
|
- spec/github/error/service_error_spec.rb
|
590
590
|
- spec/github/error/unknown_value_spec.rb
|
591
591
|
- spec/github/error/validations_spec.rb
|
592
|
+
- spec/github/gists/comments/create_spec.rb
|
593
|
+
- spec/github/gists/comments/delete_spec.rb
|
594
|
+
- spec/github/gists/comments/edit_spec.rb
|
595
|
+
- spec/github/gists/comments/get_spec.rb
|
596
|
+
- spec/github/gists/comments/list_spec.rb
|
592
597
|
- spec/github/gists/comments_spec.rb
|
593
598
|
- spec/github/gists/create_spec.rb
|
594
599
|
- spec/github/gists/delete_spec.rb
|