octokit 1.17.0 → 1.17.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  # CHANGELOG
2
2
 
3
+ * [1.17.1 - October 11, 2012](https://github.com/pengwynn/octokit/compare/v1.17.0...v1.17.1)
3
4
  * [1.17.0 - October 8, 2012](https://github.com/pengwynn/octokit/compare/v1.16.0...v1.17.0)
4
5
  * [1.16.0 - September 25,2012](https://github.com/pengwynn/octokit/compare/v1.15.1...v1.16.0)
5
6
  * [1.15.1 - September 24,2012](https://github.com/pengwynn/octokit/compare/v1.15.0...v1.15.1)
data/README.md CHANGED
@@ -98,6 +98,7 @@ end
98
98
  [pr]: http://help.github.com/send-pull-requests/
99
99
 
100
100
  ## Supported Ruby Versions
101
+
101
102
  This library aims to support and is [tested against][travis] the following Ruby
102
103
  versions:
103
104
 
@@ -116,6 +117,13 @@ implementation, you will be personally responsible for providing patches in a
116
117
  timely fashion. If critical issues for a particular implementation exist at the
117
118
  time of a major release, support for that Ruby version may be dropped.
118
119
 
120
+ ### JSON dependency
121
+
122
+ Since JSON is included in 1.9 now, we no longer include it as a hard
123
+ dependency. Please require it explicitly if you're running Ruby 1.8
124
+
125
+ gem 'json', '~> 1.7'
126
+
119
127
  ## Contributors
120
128
 
121
129
  Octokit was initially created by Wynn Netherland and [Adam
@@ -1,3 +1,3 @@
1
1
  module Octokit
2
- VERSION = "1.17.0" unless defined?(Octokit::VERSION)
2
+ VERSION = "1.17.1" unless defined?(Octokit::VERSION)
3
3
  end
@@ -6,8 +6,8 @@ Gem::Specification.new do |gem|
6
6
  gem.add_dependency 'faraday', '~> 0.8'
7
7
  gem.add_dependency 'faraday_middleware', '~> 0.8'
8
8
  gem.add_dependency 'hashie', '~> 1.2'
9
- gem.add_dependency 'json', '~> 1.7'
10
9
  gem.add_dependency 'multi_json', '~> 1.3'
10
+ gem.add_development_dependency 'json', '~> 1.7'
11
11
  gem.add_development_dependency 'maruku'
12
12
  gem.add_development_dependency 'rake'
13
13
  gem.add_development_dependency 'rspec'
@@ -25,10 +25,10 @@ describe Faraday::Response do
25
25
  to_return(:status => status)
26
26
  end
27
27
 
28
- it "should raise #{exception.name} error" do
29
- lambda do
28
+ it "raises #{exception.name} error" do
29
+ expect {
30
30
  @client.user('sferik')
31
- end.should raise_error(exception)
31
+ }.to raise_error(exception)
32
32
  end
33
33
  end
34
34
  end
@@ -44,10 +44,10 @@ describe Faraday::Response do
44
44
  to_return(:status => 400, :body => body)
45
45
  end
46
46
 
47
- it "should raise an error with the error message" do
48
- lambda do
47
+ it "raises an error with the error message" do
48
+ expect {
49
49
  @client.user('sferik')
50
- end.should raise_error(Octokit::BadRequest, /#{body.values.first}/)
50
+ }.to raise_error(Octokit::BadRequest, /#{body.values.first}/)
51
51
  end
52
52
  end
53
53
  end
@@ -4,10 +4,17 @@ unless ENV['CI']
4
4
  add_filter "/spec"
5
5
  end
6
6
  end
7
+
7
8
  require 'octokit'
8
9
  require 'rspec'
9
10
  require 'webmock/rspec'
10
11
 
12
+ RSpec.configure do |config|
13
+ config.expect_with :rspec do |c|
14
+ c.syntax = :expect
15
+ end
16
+ end
17
+
11
18
  def a_delete(url)
12
19
  a_request(:delete, github_url(url))
13
20
  end
@@ -8,52 +8,52 @@ describe Octokit::Client::Authorizations do
8
8
  end
9
9
 
10
10
 
11
- it "should list existing authorizations" do
11
+ it "lists existing authorizations" do
12
12
  stub_get("/authorizations").
13
13
  to_return(:body => fixture("v3/authorizations.json"))
14
14
  authorizations = @client.authorizations
15
- authorizations.first.app.name.should == "Calendar About Nothing"
15
+ expect(authorizations.first.app.name).to eq("Calendar About Nothing" )
16
16
  end
17
17
 
18
- it "should return a single authorization" do
18
+ it "returns a single authorization" do
19
19
  stub_get("/authorizations/999999").
20
20
  to_return(:body => fixture("v3/authorization.json"))
21
21
  authorization = @client.authorization(999999)
22
- authorization.app.name.should == "Travis"
22
+ expect(authorization.app.name).to eq("Travis" )
23
23
  end
24
24
 
25
- it "should create a new default authorization" do
25
+ it "creates a new default authorization" do
26
26
  stub_post('/authorizations').
27
27
  with(:body => {"scopes" => ""},
28
28
  :headers => {'Content-Type'=>'application/json'}).
29
29
  to_return(:body => fixture("v3/authorization.json"))
30
30
  authorization = @client.create_authorization
31
- authorization.app.name.should == "Travis"
31
+ expect(authorization.app.name).to eq("Travis" )
32
32
  end
33
33
 
34
- it "should create a new authorization with options" do
34
+ it "creates a new authorization with options" do
35
35
  stub_post('/authorizations').
36
36
  with(:body => {"scopes" => ["public_repo"],"note" => "admin script", "note_url" => "https://github.com/pengwynn/octokit"},
37
37
  :headers => {'Content-Type'=>'application/json'}).
38
38
  to_return(:body => fixture("v3/authorization.json"))
39
39
  authorization = @client.create_authorization({:scopes => ["public_repo"], :note => "admin script", :note_url => "https://github.com/pengwynn/octokit"})
40
- authorization.scopes.should include("public_repo")
40
+ expect(authorization.scopes).to include("public_repo")
41
41
  end
42
42
 
43
- it "should update and existing authorization" do
43
+ it "updates and existing authorization" do
44
44
  stub_patch('/authorizations/999999').
45
45
  with(:body => {"scopes"=>"", "add_scopes" => ["public_repo", "gist"]},
46
46
  :headers => {'Content-Type'=>'application/json'}).
47
47
  to_return(:body => fixture("v3/authorization.json"))
48
48
  authorization = @client.update_authorization(999999, {:add_scopes => ['public_repo', 'gist']})
49
- authorization.scopes.should include("public_repo")
49
+ expect(authorization.scopes).to include("public_repo")
50
50
  end
51
51
 
52
- it "should delete an existing authorization" do
52
+ it "deletes an existing authorization" do
53
53
  stub_delete('/authorizations/999999').
54
54
  to_return(:status => 204)
55
55
  authorization = @client.delete_authorization(999999)
56
- authorization.status.should == 204
56
+ expect(authorization.status).to eq(204)
57
57
  end
58
58
 
59
59
  end
@@ -9,124 +9,124 @@ describe Octokit::Client::Commits do
9
9
 
10
10
  describe ".commits" do
11
11
 
12
- it "should return all commits" do
12
+ it "returns all commits" do
13
13
  stub_get("/repos/sferik/rails_admin/commits?per_page=35&sha=master").
14
14
  to_return(:body => fixture("v3/commits.json"))
15
15
  commits = @client.commits("sferik/rails_admin")
16
- commits.first.author.login.should == "caboteria"
16
+ expect(commits.first.author.login).to eq("caboteria")
17
17
  end
18
18
 
19
19
  end
20
20
 
21
21
  describe ".commit" do
22
22
 
23
- it "should return a commit" do
23
+ it "returns a commit" do
24
24
  stub_get("/repos/sferik/rails_admin/commits/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
25
25
  to_return(:body => fixture("v3/commit.json"))
26
26
  commit = @client.commit("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
27
- commit.author.login.should == "caboteria"
27
+ expect(commit.author.login).to eq("caboteria")
28
28
  end
29
29
 
30
30
  end
31
31
 
32
32
  describe ".create_commit" do
33
33
 
34
- it "should create a commit" do
34
+ it "creates a commit" do
35
35
  stub_post("/repos/octocat/Hello-World/git/commits").
36
36
  with(:body => { :message => "My commit message", :tree => "827efc6d56897b048c772eb4087f854f46256132", :parents => ["7d1b31e74ee336d15cbd21741bc88a537ed063a0"] },
37
37
  :headers => { "Content-Type" => "application/json" }).
38
38
  to_return(:body => fixture("v3/commit_create.json"))
39
39
  commit = @client.create_commit("octocat/Hello-World", "My commit message", "827efc6d56897b048c772eb4087f854f46256132", "7d1b31e74ee336d15cbd21741bc88a537ed063a0")
40
- commit.sha.should == "7638417db6d59f3c431d3e1f261cc637155684cd"
41
- commit.message.should == "My commit message"
42
- commit.parents.size.should == 1
43
- commit.parents.first.sha.should == "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
40
+ expect(commit.sha).to eq("7638417db6d59f3c431d3e1f261cc637155684cd")
41
+ expect(commit.message).to eq("My commit message")
42
+ expect(commit.parents.size).to eq(1)
43
+ expect(commit.parents.first.sha).to eq("7d1b31e74ee336d15cbd21741bc88a537ed063a0")
44
44
  end
45
45
 
46
46
  end
47
47
 
48
48
  describe ".list_commit_comments" do
49
49
 
50
- it "should return a list of all commit comments" do
50
+ it "returns a list of all commit comments" do
51
51
  stub_get("/repos/sferik/rails_admin/comments").
52
52
  to_return(:body => fixture("v3/list_commit_comments.json"))
53
53
  commit_comments = @client.list_commit_comments("sferik/rails_admin")
54
- commit_comments.first.user.login.should == "sferik"
54
+ expect(commit_comments.first.user.login).to eq("sferik")
55
55
  end
56
56
 
57
57
  end
58
58
 
59
59
  describe ".commit_comments" do
60
60
 
61
- it "should return a list of comments for a specific commit" do
61
+ it "returns a list of comments for a specific commit" do
62
62
  stub_get("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments").
63
63
  to_return(:body => fixture("v3/commit_comments.json"))
64
64
  commit_comments = @client.commit_comments("sferik/rails_admin", "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
65
- commit_comments.first.user.login.should == "bbenezech"
65
+ expect(commit_comments.first.user.login).to eq("bbenezech")
66
66
  end
67
67
 
68
68
  end
69
69
 
70
70
  describe ".commit_comment" do
71
71
 
72
- it "should return a single commit comment" do
72
+ it "returns a single commit comment" do
73
73
  stub_get("/repos/sferik/rails_admin/comments/861907").
74
74
  to_return(:body => fixture("v3/commit_comment.json"))
75
75
  commit = @client.commit_comment("sferik/rails_admin", "861907")
76
- commit.user.login.should == "bbenezech"
76
+ expect(commit.user.login).to eq("bbenezech")
77
77
  end
78
78
 
79
79
  end
80
80
 
81
81
  describe ".create_commit_comment" do
82
82
 
83
- it "should create a commit comment" do
83
+ it "creates a commit comment" do
84
84
  stub_post("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments").
85
85
  with(:body => { :body => "Hey Eric,\r\n\r\nI think it's a terrible idea: for a number of reasons (dissections, etc.), test suite should stay deterministic IMO.\r\n", :commit_id => "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3", :line => 1, :path => ".rspec", :position => 4 },
86
86
  :headers => { "Content-Type" => "application/json" }).
87
87
  to_return(:body => fixture("v3/commit_comment_create.json"))
88
88
  commit_comment = @client.create_commit_comment("sferik/rails_admin", "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3", "Hey Eric,\r\n\r\nI think it's a terrible idea: for a number of reasons (dissections, etc.), test suite should stay deterministic IMO.\r\n", ".rspec", 1, 4)
89
- commit_comment.body.should == "Hey Eric,\r\n\r\nI think it's a terrible idea: for a number of reasons (dissections, etc.), test suite should stay deterministic IMO.\r\n"
90
- commit_comment.commit_id.should == "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3"
91
- commit_comment.path.should == ".rspec"
92
- commit_comment.line.should == 1
93
- commit_comment.position.should == 4
89
+ expect(commit_comment.body).to eq("Hey Eric,\r\n\r\nI think it's a terrible idea: for a number of reasons (dissections, etc.), test suite should stay deterministic IMO.\r\n")
90
+ expect(commit_comment.commit_id).to eq("629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
91
+ expect(commit_comment.path).to eq(".rspec")
92
+ expect(commit_comment.line).to eq(1)
93
+ expect(commit_comment.position).to eq(4)
94
94
  end
95
95
 
96
96
  end
97
97
 
98
98
  describe ".update_commit_comment" do
99
99
 
100
- it "should update a commit comment" do
100
+ it "updates a commit comment" do
101
101
  stub_patch("/repos/sferik/rails_admin/comments/860296").
102
102
  with(:body => { :body => "Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n" },
103
103
  :headers => { "Content-Type" => "application/json" }).
104
104
  to_return(:body => fixture("v3/commit_comment_update.json"))
105
105
  commit_comment = @client.update_commit_comment("sferik/rails_admin", "860296", "Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n")
106
- commit_comment.body.should == "Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n"
106
+ expect(commit_comment.body).to eq("Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n")
107
107
  end
108
108
 
109
109
  end
110
110
 
111
111
  describe ".delete_commit_comment" do
112
112
 
113
- it "should delete a commit comment" do
113
+ it "deletes a commit comment" do
114
114
  stub_delete("/repos/sferik/rails_admin/comments/860296").
115
115
  to_return(:status => 204, :body => "")
116
116
  commit_comment = @client.delete_commit_comment("sferik/rails_admin", "860296")
117
- commit_comment.should be_false
117
+ expect(commit_comment).to be_false
118
118
  end
119
119
 
120
120
  end
121
121
 
122
122
  describe ".compare" do
123
123
 
124
- it "should return a comparison" do
124
+ it "returns a comparison" do
125
125
  stub_get("/repos/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5").
126
126
  to_return(:body => fixture("v3/compare.json"))
127
127
  comparison = @client.compare("gvaughn/octokit", '0e0d7ae299514da692eb1cab741562c253d44188', 'b7b37f75a80b8e84061cd45b246232ad958158f5')
128
- comparison.base_commit.sha.should == '0e0d7ae299514da692eb1cab741562c253d44188'
129
- comparison.merge_base_commit.sha.should == 'b7b37f75a80b8e84061cd45b246232ad958158f5'
128
+ expect(comparison.base_commit.sha).to eq('0e0d7ae299514da692eb1cab741562c253d44188')
129
+ expect(comparison.merge_base_commit.sha).to eq('b7b37f75a80b8e84061cd45b246232ad958158f5')
130
130
  end
131
131
  end
132
132
 
@@ -137,10 +137,10 @@ describe Octokit::Client::Commits do
137
137
  to_return(:body => fixture("v3/merge.json"))
138
138
  end
139
139
 
140
- it "should merge a branch into another" do
140
+ it "merges a branch into another" do
141
141
  merge = @client.merge("pengwynn/api-sandbox", "master", "new-branch", :commit_message => "Testing the merge API")
142
- merge.sha.should == '4298c8499e0a7a160975adefdecdf9d8a5437095'
143
- merge.commit.message.should == 'Testing the merge API'
142
+ expect(merge.sha).to eq('4298c8499e0a7a160975adefdecdf9d8a5437095')
143
+ expect(merge.commit.message).to eq('Testing the merge API')
144
144
  end
145
145
 
146
146
  end
@@ -9,38 +9,38 @@ describe Octokit::Client::Contents do
9
9
 
10
10
  describe ".readme" do
11
11
 
12
- it "should return the default readme" do
12
+ it "returns the default readme" do
13
13
  stub_get("/repos/pengwynn/octokit/readme").
14
14
  to_return(:body => fixture("v3/readme.json"))
15
15
  readme = @client.readme('pengwynn/octokit')
16
- readme.encoding.should == "base64"
17
- readme.type.should == "file"
16
+ expect(readme.encoding).to eq("base64")
17
+ expect(readme.type).to eq("file")
18
18
  end
19
19
 
20
20
  end
21
21
 
22
22
  describe ".contents" do
23
23
 
24
- it "should return the contents of a file" do
24
+ it "returns the contents of a file" do
25
25
  stub_get("/repos/pengwynn/octokit/contents/lib/octokit.rb").
26
26
  to_return(:body => fixture("v3/contents.json"))
27
27
  contents = @client.contents('pengwynn/octokit', :path => "lib/octokit.rb")
28
- contents.path.should == "lib/octokit.rb"
29
- contents.name.should == "lib/octokit.rb"
30
- contents.encoding.should == "base64"
31
- contents.type.should == "file"
28
+ expect(contents.path).to eq("lib/octokit.rb")
29
+ expect(contents.name).to eq("lib/octokit.rb")
30
+ expect(contents.encoding).to eq("base64")
31
+ expect(contents.type).to eq("file")
32
32
  end
33
33
 
34
34
  end
35
35
 
36
36
  describe ".archive_link" do
37
37
 
38
- it "should return the headers of the request" do
38
+ it "returns the headers of the request" do
39
39
  stub_get("/repos/pengwynn/octokit/tarball/master").
40
40
  to_return(:status => 302, :body => '', :headers =>
41
41
  { 'location' => "https://nodeload.github.com/repos/pengwynn/octokit/tarball/"})
42
42
  archive_link = @client.archive_link('pengwynn/octokit', :ref => "master")
43
- archive_link == "https://nodeload.github.com/pengwynn/octokit/tarball/"
43
+ expect(archive_link).to eq("https://nodeload.github.com/repos/pengwynn/octokit/tarball/")
44
44
  end
45
45
 
46
46
  end
@@ -9,23 +9,23 @@ describe Octokit::Client::Downloads do
9
9
 
10
10
  describe ".downloads" do
11
11
 
12
- it "should list available downloads" do
12
+ it "lists available downloads" do
13
13
  stub_get("/repos/github/hubot/downloads").
14
14
  to_return(:body => fixture("v3/downloads.json"))
15
15
  downloads = @client.downloads("github/hubot")
16
- downloads.first.description.should == "Robawt"
16
+ expect(downloads.first.description).to eq("Robawt")
17
17
  end
18
18
 
19
19
  end
20
20
 
21
21
  describe ".download" do
22
22
 
23
- it "should get a single download" do
23
+ it "gets a single download" do
24
24
  stub_get("/repos/github/hubot/downloads/165347").
25
25
  to_return(:body => fixture("v3/download.json"))
26
26
  download = @client.download("github/hubot", 165347)
27
- download.id.should == 165347
28
- download.name.should == 'hubot-2.1.0.tar.gz'
27
+ expect(download.id).to eq(165347)
28
+ expect(download.name).to eq('hubot-2.1.0.tar.gz')
29
29
  end
30
30
 
31
31
  end
@@ -38,26 +38,26 @@ describe Octokit::Client::Downloads do
38
38
  :content_type => "text/plain" }).
39
39
  to_return(:body => fixture("v3/download_create.json"))
40
40
  end
41
- it "should create a download resource" do
41
+ it "creates a download resource" do
42
42
  resource = @client.send(:create_download_resource, "octocat/Hello-World", "download_create.json", 690, {:description => "Description of your download", :content_type => "text/plain"})
43
- resource.s3_url.should == "https://github.s3.amazonaws.com/"
43
+ expect(resource.s3_url).to eq("https://github.s3.amazonaws.com/")
44
44
  end
45
45
 
46
- it "should post to a S3 url" do
46
+ it "posts to an S3 url" do
47
47
  stub_post("https://github.s3.amazonaws.com/").
48
48
  to_return(:status => 201)
49
49
  file_path = File.expand_path 'spec/fixtures/v3/download_create.json'
50
- @client.create_download("octocat/Hello-World", file_path, {:description => "Description of your download", :content_type => "text/plain"}).should == true
50
+ expect(@client.create_download("octocat/Hello-World", file_path, {:description => "Description of your download", :content_type => "text/plain"})).to eq(true)
51
51
  end
52
52
  end
53
53
 
54
54
  describe ".delete_download" do
55
55
 
56
- it "should delete a download" do
56
+ it "deletes a download" do
57
57
  stub_request(:delete, "https://api.github.com/repos/octocat/Hellow-World/downloads/165347").
58
58
  with(:headers => {'Accept'=>'*/*'}).
59
59
  to_return(:status => 204, :body => "", :headers => {})
60
- @client.delete_download('octocat/Hellow-World', 165347).status.should == 204
60
+ expect(@client.delete_download('octocat/Hellow-World', 165347).status).to eq(204)
61
61
  end
62
62
  end
63
63
 
@@ -7,11 +7,11 @@ describe Octokit::Client::Emojis do
7
7
  end
8
8
 
9
9
  describe ".emojis" do
10
- it "should return all github emojis" do
10
+ it "returns all github emojis" do
11
11
  stub_get("/emojis").
12
12
  to_return(:body => fixture("v3/emojis.json"))
13
13
  emojis = @client.emojis
14
- emojis[:metal].should == 'https://a248.e.akamai.net/assets.github.com/images/icons/emoji/metal.png?v5'
14
+ expect(emojis[:metal]).to eq('https://a248.e.akamai.net/assets.github.com/images/icons/emoji/metal.png?v5')
15
15
  end
16
16
  end
17
17