github_api 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,7 +79,7 @@ describe Github::GitData::Tags do
79
79
  context "resouce created" do
80
80
  before do
81
81
  stub_post("/repos/#{user}/#{repo}/git/tags").
82
- with(:body => JSON.generate(inputs.except('unrelated'))).
82
+ with(inputs.except('unrelated')).
83
83
  to_return(:body => fixture('git_data/tag.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"})
84
84
  end
85
85
 
@@ -96,8 +96,10 @@ describe Github::GitData::Trees do
96
96
  context "resouce created" do
97
97
  before do
98
98
  stub_post("/repos/#{user}/#{repo}/git/trees").
99
- with(:body => JSON.generate(inputs)).
100
- to_return(:body => fixture('git_data/tree.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"})
99
+ with(inputs).
100
+ to_return(:body => fixture('git_data/tree.json'),
101
+ :status => 201,
102
+ :headers => {:content_type => "application/json; charset=utf-8"})
101
103
  end
102
104
 
103
105
  it "should fail to create resource if 'content' input is missing" do
@@ -138,7 +138,7 @@ describe Github::PullRequests::Comments do
138
138
  context "resouce created" do
139
139
  before do
140
140
  stub_post("/repos/#{user}/#{repo}/pulls/#{pull_request_id}/comments").
141
- with(:body => JSON.generate(inputs.except('unrelated'))).
141
+ with(inputs.except('unrelated')).
142
142
  to_return(:body => fixture('pull_requests/comment.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"})
143
143
  end
144
144
 
@@ -192,7 +192,7 @@ describe Github::PullRequests::Comments do
192
192
  context "resouce edited" do
193
193
  before do
194
194
  stub_patch("/repos/#{user}/#{repo}/pulls/comments/#{comment_id}").
195
- with(:body => JSON.generate(inputs.except('unrelated'))).
195
+ with(inputs.except('unrelated')).
196
196
  to_return(:body => fixture('pull_requests/comment.json'),
197
197
  :status => 200,
198
198
  :headers => {:content_type => "application/json; charset=utf-8"})
@@ -132,7 +132,7 @@ describe Github::PullRequests do
132
132
  context "resouce created" do
133
133
  before do
134
134
  stub_post("/repos/#{user}/#{repo}/pulls").
135
- with(:body => JSON.generate(inputs.except('unrelated'))).
135
+ with(inputs.except('unrelated')).
136
136
  to_return(:body => fixture('pull_requests/pull_request.json'), :status => 201, :headers => {:content_type => "application/json; charset=utf-8"})
137
137
  end
138
138
 
@@ -180,10 +180,10 @@ describe Github::PullRequests do
180
180
  context "resouce updateed" do
181
181
  before do
182
182
  stub_patch("/repos/#{user}/#{repo}/pulls/#{pull_request_id}").
183
- with(:body => JSON.generate(inputs.except('unrelated'))).
183
+ with(inputs.except('unrelated')).
184
184
  to_return(:body => fixture('pull_requests/pull_request.json'),
185
- :status => 201,
186
- :headers => {:content_type => "application/json; charset=utf-8"})
185
+ :status => 201,
186
+ :headers => {:content_type => "application/json; charset=utf-8"})
187
187
  end
188
188
 
189
189
  it "should create resource successfully" do
@@ -120,36 +120,37 @@ describe Github::Repos::Hooks do
120
120
  describe "#create" do
121
121
  let(:inputs) {
122
122
  {
123
- :name => 'web',
124
- :config => {
125
- :url => "http://something.com/webhook",
126
- :address => "test@example.com",
127
- :subdomain => "github",
128
- :room => "Commits",
129
- :token => "abc123"
123
+ 'name' => 'web',
124
+ 'config' => {
125
+ 'url' => "http://something.com/webhook",
126
+ 'address' => "test@example.com",
127
+ 'subdomain' => "github",
128
+ 'room' => "Commits",
129
+ 'token' => "abc123"
130
130
  },
131
- :active => true,
132
- :unrelated => true
131
+ 'active' => true,
132
+ 'unrelated' => true
133
133
  }
134
134
  }
135
135
 
136
136
  context "resouce created" do
137
137
  before do
138
138
  stub_post("/repos/#{user}/#{repo}/hooks").
139
- with(:body => JSON.generate(inputs.except(:unrelated))).
140
- to_return(:body => fixture('repos/hook.json'), :status => 201,
139
+ with(inputs.except('unrelated')).
140
+ to_return(:body => fixture('repos/hook.json'),
141
+ :status => 201,
141
142
  :headers => {:content_type => "application/json; charset=utf-8"})
142
143
  end
143
144
 
144
145
  it "should fail to create resource if 'name' input is missing" do
145
146
  expect {
146
- github.repos.hooks.create user, repo, inputs.except(:name)
147
+ github.repos.hooks.create user, repo, inputs.except('name')
147
148
  }.to raise_error(Github::Error::RequiredParams)
148
149
  end
149
150
 
150
151
  it "should failt to create resource if 'config' input is missing" do
151
152
  expect {
152
- github.repos.hooks.create user, repo, inputs.except(:config)
153
+ github.repos.hooks.create user, repo, inputs.except('config')
153
154
  }.to raise_error(Github::Error::RequiredParams)
154
155
  end
155
156
 
@@ -204,7 +205,7 @@ describe Github::Repos::Hooks do
204
205
  context "resource edited successfully" do
205
206
  before do
206
207
  stub_patch("/repos/#{user}/#{repo}/hooks/#{hook_id}").
207
- with(:body => JSON.generate(inputs.except(:unrelated))).
208
+ with(inputs.except(:unrelated)).
208
209
  to_return(:body => fixture("repos/hook.json"), :status => 200,
209
210
  :headers => { :content_type => "application/json; charset=utf-8"})
210
211
  end
@@ -79,6 +79,46 @@ describe Github::Repos do
79
79
  end
80
80
  end # branches
81
81
 
82
+ describe "#branch" do
83
+ let(:branch) { 'master' }
84
+
85
+ context "resource found" do
86
+ before do
87
+ stub_get("/repos/#{user}/#{repo}/branches/#{branch}").
88
+ to_return(:body => fixture('repos/branch.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
89
+ end
90
+
91
+ it "should find resources" do
92
+ github.repos.branch user, repo, branch
93
+ a_get("/repos/#{user}/#{repo}/branches/#{branch}").should have_been_made
94
+ end
95
+
96
+ it "should return repository mash" do
97
+ repo_branch = github.repos.branch user, repo, branch
98
+ repo_branch.should be_a Hashie::Mash
99
+ end
100
+
101
+ it "should get repository branch information" do
102
+ repo_branch = github.repos.branch user, repo, branch
103
+ repo_branch.name.should == 'master'
104
+ end
105
+ end
106
+
107
+ context "resource not found" do
108
+ before do
109
+ stub_get("/repos/#{user}/#{repo}/branches/#{branch}").
110
+ to_return(:body => '', :status => 404,
111
+ :headers => {:content_type => "application/json; charset=utf-8"})
112
+ end
113
+
114
+ it "should fail to get resource" do
115
+ expect {
116
+ github.repos.branch user, repo, branch
117
+ }.to raise_error(Github::Error::NotFound)
118
+ end
119
+ end
120
+ end # branch
121
+
82
122
  describe "contributors" do
83
123
  context "resource found" do
84
124
  before do
@@ -122,7 +122,7 @@ describe Github::Users::Keys do
122
122
  context "resouce created" do
123
123
  before do
124
124
  stub_post("/user/keys?access_token=#{OAUTH_TOKEN}").
125
- with(:body => JSON.generate(inputs.except(:unrelated))).
125
+ with(inputs.except(:unrelated)).
126
126
  to_return(:body => fixture('users/key.json'),
127
127
  :status => 201,
128
128
  :headers => {:content_type => "application/json; charset=utf-8"})
@@ -173,7 +173,7 @@ describe Github::Users::Keys do
173
173
  context "resouce updated" do
174
174
  before do
175
175
  stub_patch("/user/keys/#{key_id}?access_token=#{OAUTH_TOKEN}").
176
- with(:body => JSON.generate(inputs.except(:unrelated))).
176
+ with(inputs.except(:unrelated)).
177
177
  to_return(:body => fixture('users/key.json'),
178
178
  :status => 201,
179
179
  :headers => {:content_type => "application/json; charset=utf-8"})
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.6.1
4
+ version: 0.6.2
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: 2012-06-24 00:00:00.000000000Z
12
+ date: 2012-07-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
16
- requirement: &2153407020 !ruby/object:Gem::Requirement
16
+ requirement: &2153389620 !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: *2153407020
24
+ version_requirements: *2153389620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &2153406520 !ruby/object:Gem::Requirement
27
+ requirement: &2153389100 !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: *2153406520
35
+ version_requirements: *2153389100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_json
38
- requirement: &2153406040 !ruby/object:Gem::Requirement
38
+ requirement: &2153388580 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153406040
46
+ version_requirements: *2153388580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: oauth2
49
- requirement: &2153400220 !ruby/object:Gem::Requirement
49
+ requirement: &2153388020 !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: *2153400220
57
+ version_requirements: *2153388020
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: nokogiri
60
- requirement: &2153399560 !ruby/object:Gem::Requirement
60
+ requirement: &2153387460 !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: *2153399560
68
+ version_requirements: *2153387460
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &2153399020 !ruby/object:Gem::Requirement
71
+ requirement: &2153386960 !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: *2153399020
79
+ version_requirements: *2153386960
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cucumber
82
- requirement: &2153398480 !ruby/object:Gem::Requirement
82
+ requirement: &2153386480 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,21 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153398480
91
- - !ruby/object:Gem::Dependency
92
- name: yajl-ruby
93
- requirement: &2153397960 !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ~>
97
- - !ruby/object:Gem::Version
98
- version: 1.1.0
99
- type: :development
100
- prerelease: false
101
- version_requirements: *2153397960
90
+ version_requirements: *2153386480
102
91
  - !ruby/object:Gem::Dependency
103
92
  name: webmock
104
- requirement: &2153397380 !ruby/object:Gem::Requirement
93
+ requirement: &2153386000 !ruby/object:Gem::Requirement
105
94
  none: false
106
95
  requirements:
107
96
  - - ~>
@@ -109,10 +98,10 @@ dependencies:
109
98
  version: 1.8.0
110
99
  type: :development
111
100
  prerelease: false
112
- version_requirements: *2153397380
101
+ version_requirements: *2153386000
113
102
  - !ruby/object:Gem::Dependency
114
103
  name: vcr
115
- requirement: &2153396800 !ruby/object:Gem::Requirement
104
+ requirement: &2153385500 !ruby/object:Gem::Requirement
116
105
  none: false
117
106
  requirements:
118
107
  - - ~>
@@ -120,10 +109,10 @@ dependencies:
120
109
  version: 2.2.0
121
110
  type: :development
122
111
  prerelease: false
123
- version_requirements: *2153396800
112
+ version_requirements: *2153385500
124
113
  - !ruby/object:Gem::Dependency
125
114
  name: simplecov
126
- requirement: &2153396220 !ruby/object:Gem::Requirement
115
+ requirement: &2153385020 !ruby/object:Gem::Requirement
127
116
  none: false
128
117
  requirements:
129
118
  - - ~>
@@ -131,10 +120,10 @@ dependencies:
131
120
  version: 0.6.1
132
121
  type: :development
133
122
  prerelease: false
134
- version_requirements: *2153396220
123
+ version_requirements: *2153385020
135
124
  - !ruby/object:Gem::Dependency
136
125
  name: guard
137
- requirement: &2153395720 !ruby/object:Gem::Requirement
126
+ requirement: &2153384580 !ruby/object:Gem::Requirement
138
127
  none: false
139
128
  requirements:
140
129
  - - ! '>='
@@ -142,10 +131,10 @@ dependencies:
142
131
  version: '0'
143
132
  type: :development
144
133
  prerelease: false
145
- version_requirements: *2153395720
134
+ version_requirements: *2153384580
146
135
  - !ruby/object:Gem::Dependency
147
136
  name: guard-rspec
148
- requirement: &2153395140 !ruby/object:Gem::Requirement
137
+ requirement: &2153384040 !ruby/object:Gem::Requirement
149
138
  none: false
150
139
  requirements:
151
140
  - - ! '>='
@@ -153,10 +142,10 @@ dependencies:
153
142
  version: '0'
154
143
  type: :development
155
144
  prerelease: false
156
- version_requirements: *2153395140
145
+ version_requirements: *2153384040
157
146
  - !ruby/object:Gem::Dependency
158
147
  name: guard-cucumber
159
- requirement: &2153394600 !ruby/object:Gem::Requirement
148
+ requirement: &2153383600 !ruby/object:Gem::Requirement
160
149
  none: false
161
150
  requirements:
162
151
  - - ! '>='
@@ -164,10 +153,10 @@ dependencies:
164
153
  version: '0'
165
154
  type: :development
166
155
  prerelease: false
167
- version_requirements: *2153394600
156
+ version_requirements: *2153383600
168
157
  - !ruby/object:Gem::Dependency
169
158
  name: rake
170
- requirement: &2153394100 !ruby/object:Gem::Requirement
159
+ requirement: &2153383160 !ruby/object:Gem::Requirement
171
160
  none: false
172
161
  requirements:
173
162
  - - ! '>='
@@ -175,10 +164,10 @@ dependencies:
175
164
  version: '0'
176
165
  type: :development
177
166
  prerelease: false
178
- version_requirements: *2153394100
167
+ version_requirements: *2153383160
179
168
  - !ruby/object:Gem::Dependency
180
169
  name: bundler
181
- requirement: &2153393640 !ruby/object:Gem::Requirement
170
+ requirement: &2153382720 !ruby/object:Gem::Requirement
182
171
  none: false
183
172
  requirements:
184
173
  - - ! '>='
@@ -186,7 +175,7 @@ dependencies:
186
175
  version: '0'
187
176
  type: :development
188
177
  prerelease: false
189
- version_requirements: *2153393640
178
+ version_requirements: *2153382720
190
179
  description: ! ' Ruby wrapper that supports all of the GitHub API v3 methods(nearly
191
180
  200). It''s build in a modular way, that is, you can either instantiate the whole
192
181
  api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely
@@ -219,11 +208,14 @@ files:
219
208
  - features/cassettes/git_data/references/all.yml
220
209
  - features/cassettes/git_data/references/all_tags.yml
221
210
  - features/cassettes/git_data/references/one.yml
211
+ - features/cassettes/git_data/tags/get.yml
222
212
  - features/cassettes/issues/create.yml
223
213
  - features/cassettes/issues/edit.yml
224
214
  - features/cassettes/issues/get.yml
225
215
  - features/cassettes/issues/list/repo.yml
226
216
  - features/cassettes/issues/list/user.yml
217
+ - features/cassettes/markdown/render.yml
218
+ - features/cassettes/markdown/render_raw.yml
227
219
  - features/cassettes/orgs/get.yml
228
220
  - features/cassettes/orgs/list/oauth_user.yml
229
221
  - features/cassettes/orgs/list/user.yml
@@ -243,6 +235,7 @@ files:
243
235
  - features/cassettes/pagination/repos/per_page/first.yml
244
236
  - features/cassettes/pull_requests/get.yml
245
237
  - features/cassettes/pull_requests/list.yml
238
+ - features/cassettes/repos/branch.yml
246
239
  - features/cassettes/repos/branches.yml
247
240
  - features/cassettes/repos/contents/archive.yml
248
241
  - features/cassettes/repos/contents/get.yml
@@ -267,8 +260,10 @@ files:
267
260
  - features/gists/comments.feature
268
261
  - features/gists.feature
269
262
  - features/git_data/references.feature
263
+ - features/git_data/tags.feature
270
264
  - features/github_api.feature
271
265
  - features/issues.feature
266
+ - features/markdown.feature
272
267
  - features/options.feature
273
268
  - features/orgs.feature
274
269
  - features/pagination.feature
@@ -329,6 +324,7 @@ files:
329
324
  - lib/github_api/issues/labels.rb
330
325
  - lib/github_api/issues/milestones.rb
331
326
  - lib/github_api/issues.rb
327
+ - lib/github_api/markdown.rb
332
328
  - lib/github_api/mime_type.rb
333
329
  - lib/github_api/normalizer.rb
334
330
  - lib/github_api/orgs/members.rb
@@ -418,6 +414,7 @@ files:
418
414
  - spec/fixtures/pull_requests/merge_success.json
419
415
  - spec/fixtures/pull_requests/pull_request.json
420
416
  - spec/fixtures/pull_requests/pull_requests.json
417
+ - spec/fixtures/repos/branch.json
421
418
  - spec/fixtures/repos/branches.json
422
419
  - spec/fixtures/repos/collaborators.json
423
420
  - spec/fixtures/repos/commit.json
@@ -528,7 +525,7 @@ files:
528
525
  homepage: https://github.com/peter-murach/github
529
526
  licenses: []
530
527
  post_install_message: ! "\n--------------------------------------------------------------------------------\nThank
531
- you for installing github_api-0.6.1.\n\n*NOTE*: Version 0.5.0 introduces breaking
528
+ you for installing github_api-0.6.2.\n\n*NOTE*: Version 0.5.0 introduces breaking
532
529
  changes to the way github api is queried.\nThe interface has been rewritten to be
533
530
  more consistent with REST verbs that\ninteract with GitHub hypermedia resources.
534
531
  Thus, to list resources 'list' or 'all'\nverbs are used, to retrieve individual