Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: octokit/octokit.rb
base: v1.17.0
...
head fork: octokit/octokit.rb
compare: v1.17.1
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 31 files changed
  • 2 commit comments
  • 2 contributors
Commits on Oct 10, 2012
@sferik sferik Convert to the new RSpec expectation syntax 18fc308
Commits on Oct 11, 2012
@pengwynn pengwynn Remove hard JSON dependency
Adding JSON as a hard dependency is posing a problem for some
users on 1.9 wishing to avoid native extensions. Removing the
dependency and updating README with workaround.

refs pengwynn/faraday_middleware#50
b1daac9
@pengwynn pengwynn Adding development dependency for JSON for Travis 727bb98
@pengwynn pengwynn Bump to 1.17.1 a771f4e
Showing with 498 additions and 482 deletions.
  1. +1 −0  CHANGELOG.md
  2. +8 −0 README.md
  3. +1 −1  lib/octokit/version.rb
  4. +1 −1  octokit.gemspec
  5. +6 −6 spec/faraday/response_spec.rb
  6. +7 −0 spec/helper.rb
  7. +12 −12 spec/octokit/client/authorizations_spec.rb
  8. +31 −31 spec/octokit/client/commits_spec.rb
  9. +10 −10 spec/octokit/client/contents_spec.rb
  10. +11 −11 spec/octokit/client/downloads_spec.rb
  11. +2 −2 spec/octokit/client/emojis_spec.rb
  12. +8 −8 spec/octokit/client/events_spec.rb
  13. +26 −26 spec/octokit/client/gists_spec.rb
  14. +6 −6 spec/octokit/client/issue_events_spec.rb
  15. +30 −30 spec/octokit/client/issues_spec.rb
  16. +28 −28 spec/octokit/client/labels_spec.rb
  17. +2 −2 spec/octokit/client/markdown_spec.rb
  18. +10 −10 spec/octokit/client/milestones_spec.rb
  19. +11 −11 spec/octokit/client/objects_spec.rb
  20. +41 −41 spec/octokit/client/organizations_spec.rb
  21. +2 −2 spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb
  22. +4 −4 spec/octokit/client/pub_sub_hubbub_spec.rb
  23. +20 −20 spec/octokit/client/pulls_spec.rb
  24. +15 −15 spec/octokit/client/refs_spec.rb
  25. +83 −83 spec/octokit/client/repositories_spec.rb
  26. +6 −6 spec/octokit/client/statuses_spec.rb
  27. +48 −48 spec/octokit/client/users_spec.rb
  28. +27 −27 spec/octokit/client_spec.rb
  29. +14 −14 spec/octokit/gist_spec.rb
  30. +6 −6 spec/octokit_spec.rb
  31. +21 −21 spec/repository_spec.rb
View
1  CHANGELOG.md
@@ -1,5 +1,6 @@
# CHANGELOG
+* [1.17.1 - October 11, 2012](https://github.com/pengwynn/octokit/compare/v1.17.0...v1.17.1)
* [1.17.0 - October 8, 2012](https://github.com/pengwynn/octokit/compare/v1.16.0...v1.17.0)
* [1.16.0 - September 25,2012](https://github.com/pengwynn/octokit/compare/v1.15.1...v1.16.0)
* [1.15.1 - September 24,2012](https://github.com/pengwynn/octokit/compare/v1.15.0...v1.15.1)
View
8 README.md
@@ -98,6 +98,7 @@ end
[pr]: http://help.github.com/send-pull-requests/
## Supported Ruby Versions
+
This library aims to support and is [tested against][travis] the following Ruby
versions:
@@ -116,6 +117,13 @@ implementation, you will be personally responsible for providing patches in a
timely fashion. If critical issues for a particular implementation exist at the
time of a major release, support for that Ruby version may be dropped.
+### JSON dependency
+
+Since JSON is included in 1.9 now, we no longer include it as a hard
+dependency. Please require it explicitly if you're running Ruby 1.8
+
+ gem 'json', '~> 1.7'
+
## Contributors
Octokit was initially created by Wynn Netherland and [Adam
View
2  lib/octokit/version.rb
@@ -1,3 +1,3 @@
module Octokit
- VERSION = "1.17.0" unless defined?(Octokit::VERSION)
+ VERSION = "1.17.1" unless defined?(Octokit::VERSION)
end
View
2  octokit.gemspec
@@ -6,8 +6,8 @@ Gem::Specification.new do |gem|
gem.add_dependency 'faraday', '~> 0.8'
gem.add_dependency 'faraday_middleware', '~> 0.8'
gem.add_dependency 'hashie', '~> 1.2'
- gem.add_dependency 'json', '~> 1.7'
gem.add_dependency 'multi_json', '~> 1.3'
+ gem.add_development_dependency 'json', '~> 1.7'
gem.add_development_dependency 'maruku'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec'
View
12 spec/faraday/response_spec.rb
@@ -25,10 +25,10 @@
to_return(:status => status)
end
- it "should raise #{exception.name} error" do
- lambda do
+ it "raises #{exception.name} error" do
+ expect {
@client.user('sferik')
- end.should raise_error(exception)
+ }.to raise_error(exception)
end
end
end
@@ -44,10 +44,10 @@
to_return(:status => 400, :body => body)
end
- it "should raise an error with the error message" do
- lambda do
+ it "raises an error with the error message" do
+ expect {
@client.user('sferik')
- end.should raise_error(Octokit::BadRequest, /#{body.values.first}/)
+ }.to raise_error(Octokit::BadRequest, /#{body.values.first}/)
end
end
end
View
7 spec/helper.rb
@@ -4,10 +4,17 @@
add_filter "/spec"
end
end
+
require 'octokit'
require 'rspec'
require 'webmock/rspec'
+RSpec.configure do |config|
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
+end
+
def a_delete(url)
a_request(:delete, github_url(url))
end
View
24 spec/octokit/client/authorizations_spec.rb
@@ -8,52 +8,52 @@
end
- it "should list existing authorizations" do
+ it "lists existing authorizations" do
stub_get("/authorizations").
to_return(:body => fixture("v3/authorizations.json"))
authorizations = @client.authorizations
- authorizations.first.app.name.should == "Calendar About Nothing"
+ expect(authorizations.first.app.name).to eq("Calendar About Nothing" )
end
- it "should return a single authorization" do
+ it "returns a single authorization" do
stub_get("/authorizations/999999").
to_return(:body => fixture("v3/authorization.json"))
authorization = @client.authorization(999999)
- authorization.app.name.should == "Travis"
+ expect(authorization.app.name).to eq("Travis" )
end
- it "should create a new default authorization" do
+ it "creates a new default authorization" do
stub_post('/authorizations').
with(:body => {"scopes" => ""},
:headers => {'Content-Type'=>'application/json'}).
to_return(:body => fixture("v3/authorization.json"))
authorization = @client.create_authorization
- authorization.app.name.should == "Travis"
+ expect(authorization.app.name).to eq("Travis" )
end
- it "should create a new authorization with options" do
+ it "creates a new authorization with options" do
stub_post('/authorizations').
with(:body => {"scopes" => ["public_repo"],"note" => "admin script", "note_url" => "https://github.com/pengwynn/octokit"},
:headers => {'Content-Type'=>'application/json'}).
to_return(:body => fixture("v3/authorization.json"))
authorization = @client.create_authorization({:scopes => ["public_repo"], :note => "admin script", :note_url => "https://github.com/pengwynn/octokit"})
- authorization.scopes.should include("public_repo")
+ expect(authorization.scopes).to include("public_repo")
end
- it "should update and existing authorization" do
+ it "updates and existing authorization" do
stub_patch('/authorizations/999999').
with(:body => {"scopes"=>"", "add_scopes" => ["public_repo", "gist"]},
:headers => {'Content-Type'=>'application/json'}).
to_return(:body => fixture("v3/authorization.json"))
authorization = @client.update_authorization(999999, {:add_scopes => ['public_repo', 'gist']})
- authorization.scopes.should include("public_repo")
+ expect(authorization.scopes).to include("public_repo")
end
- it "should delete an existing authorization" do
+ it "deletes an existing authorization" do
stub_delete('/authorizations/999999').
to_return(:status => 204)
authorization = @client.delete_authorization(999999)
- authorization.status.should == 204
+ expect(authorization.status).to eq(204)
end
end
View
62 spec/octokit/client/commits_spec.rb
@@ -9,124 +9,124 @@
describe ".commits" do
- it "should return all commits" do
+ it "returns all commits" do
stub_get("/repos/sferik/rails_admin/commits?per_page=35&sha=master").
to_return(:body => fixture("v3/commits.json"))
commits = @client.commits("sferik/rails_admin")
- commits.first.author.login.should == "caboteria"
+ expect(commits.first.author.login).to eq("caboteria")
end
end
describe ".commit" do
- it "should return a commit" do
+ it "returns a commit" do
stub_get("/repos/sferik/rails_admin/commits/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
to_return(:body => fixture("v3/commit.json"))
commit = @client.commit("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
- commit.author.login.should == "caboteria"
+ expect(commit.author.login).to eq("caboteria")
end
end
describe ".create_commit" do
- it "should create a commit" do
+ it "creates a commit" do
stub_post("/repos/octocat/Hello-World/git/commits").
with(:body => { :message => "My commit message", :tree => "827efc6d56897b048c772eb4087f854f46256132", :parents => ["7d1b31e74ee336d15cbd21741bc88a537ed063a0"] },
:headers => { "Content-Type" => "application/json" }).
to_return(:body => fixture("v3/commit_create.json"))
commit = @client.create_commit("octocat/Hello-World", "My commit message", "827efc6d56897b048c772eb4087f854f46256132", "7d1b31e74ee336d15cbd21741bc88a537ed063a0")
- commit.sha.should == "7638417db6d59f3c431d3e1f261cc637155684cd"
- commit.message.should == "My commit message"
- commit.parents.size.should == 1
- commit.parents.first.sha.should == "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
+ expect(commit.sha).to eq("7638417db6d59f3c431d3e1f261cc637155684cd")
+ expect(commit.message).to eq("My commit message")
+ expect(commit.parents.size).to eq(1)
+ expect(commit.parents.first.sha).to eq("7d1b31e74ee336d15cbd21741bc88a537ed063a0")
end
end
describe ".list_commit_comments" do
- it "should return a list of all commit comments" do
+ it "returns a list of all commit comments" do
stub_get("/repos/sferik/rails_admin/comments").
to_return(:body => fixture("v3/list_commit_comments.json"))
commit_comments = @client.list_commit_comments("sferik/rails_admin")
- commit_comments.first.user.login.should == "sferik"
+ expect(commit_comments.first.user.login).to eq("sferik")
end
end
describe ".commit_comments" do
- it "should return a list of comments for a specific commit" do
+ it "returns a list of comments for a specific commit" do
stub_get("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments").
to_return(:body => fixture("v3/commit_comments.json"))
commit_comments = @client.commit_comments("sferik/rails_admin", "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
- commit_comments.first.user.login.should == "bbenezech"
+ expect(commit_comments.first.user.login).to eq("bbenezech")
end
end
describe ".commit_comment" do
- it "should return a single commit comment" do
+ it "returns a single commit comment" do
stub_get("/repos/sferik/rails_admin/comments/861907").
to_return(:body => fixture("v3/commit_comment.json"))
commit = @client.commit_comment("sferik/rails_admin", "861907")
- commit.user.login.should == "bbenezech"
+ expect(commit.user.login).to eq("bbenezech")
end
end
describe ".create_commit_comment" do
- it "should create a commit comment" do
+ it "creates a commit comment" do
stub_post("/repos/sferik/rails_admin/commits/629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3/comments").
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 },
:headers => { "Content-Type" => "application/json" }).
to_return(:body => fixture("v3/commit_comment_create.json"))
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)
- 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"
- commit_comment.commit_id.should == "629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3"
- commit_comment.path.should == ".rspec"
- commit_comment.line.should == 1
- commit_comment.position.should == 4
+ 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")
+ expect(commit_comment.commit_id).to eq("629e9fd9d4df25528e84d31afdc8ebeb0f56fbb3")
+ expect(commit_comment.path).to eq(".rspec")
+ expect(commit_comment.line).to eq(1)
+ expect(commit_comment.position).to eq(4)
end
end
describe ".update_commit_comment" do
- it "should update a commit comment" do
+ it "updates a commit comment" do
stub_patch("/repos/sferik/rails_admin/comments/860296").
with(:body => { :body => "Hey Eric,\r\n\r\nI think it's a terrible idea. The test suite should stay deterministic IMO.\r\n" },
:headers => { "Content-Type" => "application/json" }).
to_return(:body => fixture("v3/commit_comment_update.json"))
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")
- 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"
+ 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")
end
end
describe ".delete_commit_comment" do
- it "should delete a commit comment" do
+ it "deletes a commit comment" do
stub_delete("/repos/sferik/rails_admin/comments/860296").
to_return(:status => 204, :body => "")
commit_comment = @client.delete_commit_comment("sferik/rails_admin", "860296")
- commit_comment.should be_false
+ expect(commit_comment).to be_false
end
end
describe ".compare" do
- it "should return a comparison" do
+ it "returns a comparison" do
stub_get("/repos/gvaughn/octokit/compare/0e0d7ae299514da692eb1cab741562c253d44188...b7b37f75a80b8e84061cd45b246232ad958158f5").
to_return(:body => fixture("v3/compare.json"))
comparison = @client.compare("gvaughn/octokit", '0e0d7ae299514da692eb1cab741562c253d44188', 'b7b37f75a80b8e84061cd45b246232ad958158f5')
- comparison.base_commit.sha.should == '0e0d7ae299514da692eb1cab741562c253d44188'
- comparison.merge_base_commit.sha.should == 'b7b37f75a80b8e84061cd45b246232ad958158f5'
+ expect(comparison.base_commit.sha).to eq('0e0d7ae299514da692eb1cab741562c253d44188')
+ expect(comparison.merge_base_commit.sha).to eq('b7b37f75a80b8e84061cd45b246232ad958158f5')
end
end
@@ -137,10 +137,10 @@
to_return(:body => fixture("v3/merge.json"))
end
- it "should merge a branch into another" do
+ it "merges a branch into another" do
merge = @client.merge("pengwynn/api-sandbox", "master", "new-branch", :commit_message => "Testing the merge API")
- merge.sha.should == '4298c8499e0a7a160975adefdecdf9d8a5437095'
- merge.commit.message.should == 'Testing the merge API'
+ expect(merge.sha).to eq('4298c8499e0a7a160975adefdecdf9d8a5437095')
+ expect(merge.commit.message).to eq('Testing the merge API')
end
end
View
20 spec/octokit/client/contents_spec.rb
@@ -9,38 +9,38 @@
describe ".readme" do
- it "should return the default readme" do
+ it "returns the default readme" do
stub_get("/repos/pengwynn/octokit/readme").
to_return(:body => fixture("v3/readme.json"))
readme = @client.readme('pengwynn/octokit')
- readme.encoding.should == "base64"
- readme.type.should == "file"
+ expect(readme.encoding).to eq("base64")
+ expect(readme.type).to eq("file")
end
end
describe ".contents" do
- it "should return the contents of a file" do
+ it "returns the contents of a file" do
stub_get("/repos/pengwynn/octokit/contents/lib/octokit.rb").
to_return(:body => fixture("v3/contents.json"))
contents = @client.contents('pengwynn/octokit', :path => "lib/octokit.rb")
- contents.path.should == "lib/octokit.rb"
- contents.name.should == "lib/octokit.rb"
- contents.encoding.should == "base64"
- contents.type.should == "file"
+ expect(contents.path).to eq("lib/octokit.rb")
+ expect(contents.name).to eq("lib/octokit.rb")
+ expect(contents.encoding).to eq("base64")
+ expect(contents.type).to eq("file")
end
end
describe ".archive_link" do
- it "should return the headers of the request" do
+ it "returns the headers of the request" do
stub_get("/repos/pengwynn/octokit/tarball/master").
to_return(:status => 302, :body => '', :headers =>
{ 'location' => "https://nodeload.github.com/repos/pengwynn/octokit/tarball/"})
archive_link = @client.archive_link('pengwynn/octokit', :ref => "master")
- archive_link == "https://nodeload.github.com/pengwynn/octokit/tarball/"
+ expect(archive_link).to eq("https://nodeload.github.com/repos/pengwynn/octokit/tarball/")
end
end
View
22 spec/octokit/client/downloads_spec.rb
@@ -9,23 +9,23 @@
describe ".downloads" do
- it "should list available downloads" do
+ it "lists available downloads" do
stub_get("/repos/github/hubot/downloads").
to_return(:body => fixture("v3/downloads.json"))
downloads = @client.downloads("github/hubot")
- downloads.first.description.should == "Robawt"
+ expect(downloads.first.description).to eq("Robawt")
end
end
describe ".download" do
- it "should get a single download" do
+ it "gets a single download" do
stub_get("/repos/github/hubot/downloads/165347").
to_return(:body => fixture("v3/download.json"))
download = @client.download("github/hubot", 165347)
- download.id.should == 165347
- download.name.should == 'hubot-2.1.0.tar.gz'
+ expect(download.id).to eq(165347)
+ expect(download.name).to eq('hubot-2.1.0.tar.gz')
end
end
@@ -38,26 +38,26 @@
:content_type => "text/plain" }).
to_return(:body => fixture("v3/download_create.json"))
end
- it "should create a download resource" do
+ it "creates a download resource" do
resource = @client.send(:create_download_resource, "octocat/Hello-World", "download_create.json", 690, {:description => "Description of your download", :content_type => "text/plain"})
- resource.s3_url.should == "https://github.s3.amazonaws.com/"
+ expect(resource.s3_url).to eq("https://github.s3.amazonaws.com/")
end
- it "should post to a S3 url" do
+ it "posts to an S3 url" do
stub_post("https://github.s3.amazonaws.com/").
to_return(:status => 201)
file_path = File.expand_path 'spec/fixtures/v3/download_create.json'
- @client.create_download("octocat/Hello-World", file_path, {:description => "Description of your download", :content_type => "text/plain"}).should == true
+ expect(@client.create_download("octocat/Hello-World", file_path, {:description => "Description of your download", :content_type => "text/plain"})).to eq(true)
end
end
describe ".delete_download" do
- it "should delete a download" do
+ it "deletes a download" do
stub_request(:delete, "https://api.github.com/repos/octocat/Hellow-World/downloads/165347").
with(:headers => {'Accept'=>'*/*'}).
to_return(:status => 204, :body => "", :headers => {})
- @client.delete_download('octocat/Hellow-World', 165347).status.should == 204
+ expect(@client.delete_download('octocat/Hellow-World', 165347).status).to eq(204)
end
end
View
4 spec/octokit/client/emojis_spec.rb
@@ -7,11 +7,11 @@
end
describe ".emojis" do
- it "should return all github emojis" do
+ it "returns all github emojis" do
stub_get("/emojis").
to_return(:body => fixture("v3/emojis.json"))
emojis = @client.emojis
- emojis[:metal].should == 'https://a248.e.akamai.net/assets.github.com/images/icons/emoji/metal.png?v5'
+ expect(emojis[:metal]).to eq('https://a248.e.akamai.net/assets.github.com/images/icons/emoji/metal.png?v5')
end
end
View
16 spec/octokit/client/events_spec.rb
@@ -7,38 +7,38 @@
end
describe ".public_events" do
- it "should return all public events" do
+ it "returns all public events" do
stub_get("/events").
to_return(:body => fixture("v3/public_events.json"))
public_events = @client.public_events
- public_events.first.id.should == '1513284759'
+ expect(public_events.first.id).to eq('1513284759')
end
end
describe ".user_events" do
- it "should return all user events" do
+ it "returns all user events" do
stub_get("/users/sferik/events").
to_return(:body => fixture("v3/user_events.json"))
user_events = @client.user_events('sferik')
- user_events.first.id.should == '1525888969'
+ expect(user_events.first.id).to eq('1525888969')
end
end
describe ".received_events" do
- it "should return all user received events" do
+ it "returns all user received events" do
stub_get("/users/sferik/received_events").
to_return(:body => fixture("v3/user_events.json"))
received_events = @client.received_events('sferik')
- received_events.first.type.should == 'PushEvent'
+ expect(received_events.first.type).to eq('PushEvent')
end
end
describe ".repository_events" do
- it "should return events for a repository" do
+ it "returns events for a repository" do
stub_get("/repos/sferik/rails_admin/events").
to_return(:body => fixture("v3/repo_events.json"))
repo_events = @client.repository_events("sferik/rails_admin")
- repo_events.first.type.should == "IssuesEvent"
+ expect(repo_events.first.type).to eq("IssuesEvent")
end
end
View
52 spec/octokit/client/gists_spec.rb
@@ -9,50 +9,50 @@
end
describe ".public_gists" do
- it "should return public gists" do
+ it "returns public gists" do
stub_get("/gists/public").to_return(:body => fixture("v3/public_gists.json"))
gists = @client.public_gists
- gists.should_not be_empty
+ expect(gists).not_to be_empty
end
end # .public_gists
describe ".gists" do
context "with username passed" do
- it "should return a list of gists" do
+ it "returns a list of gists" do
stub_get("/users/#{@username}/gists").
to_return(:body => fixture("v3/gists.json"))
gists = @client.gists(@username)
- gists.first.user.login.should == @username
+ expect(gists.first.user.login).to eq(@username)
end
end
context "without a username passed" do
- it "should return a list of gists" do
+ it "returns a list of gists" do
stub_get("/gists").to_return(:body => fixture("v3/gists.json"))
gists = @client.gists
- gists.first.user.login.should == @username
+ expect(gists.first.user.login).to eq(@username)
end
end
end # .gists
describe ".starred_gists" do
- it "should return the user's starred gists" do
+ it "returns the user's starred gists" do
stub_get("/gists/starred").to_return(:body => fixture("v3/starred_gists.json"))
gists = @client.starred_gists
- gists.should_not be_empty
+ expect(gists).not_to be_empty
end
end
describe ".gist" do
- it "should return the gist by ID" do
+ it "returns the gist by ID" do
stub_get("/gists/1").to_return(:body => fixture("v3/gist.json"))
gist = @client.gist(1)
- gist.user.login.should == @username
+ expect(gist.user.login).to eq(@username)
end
end
describe ".create_gist" do
- it "should create a new gist" do
+ it "creates a new gist" do
gist_content = JSON.parse(fixture("v3/gist.json").read)
new_gist = {
:description => gist_content['description'],
@@ -64,12 +64,12 @@
to_return(:body => fixture("v3/gist.json"))
gist = @client.create_gist(new_gist)
- gist.should == gist_content
+ expect(gist).to eq(gist_content)
end
end
describe ".edit_gist" do
- it "should edit an existing gist" do
+ it "edit an existing gist" do
gist_content = JSON.parse(fixture("v3/gist.json").read)
gist_id = gist_content['id']
updated_gist = gist_content.merge('description' => 'updated')
@@ -78,55 +78,55 @@
to_return(:body => updated_gist)
gist = @client.edit_gist(gist_id, :description => 'updated')
- gist['description'].should == 'updated'
+ expect(gist['description']).to eq('updated')
end
end
describe ".star_gist" do
- it "should star an existing gist" do
+ it "stars an existing gist" do
stub_put("/gists/12345/star").to_return(:status => 204)
success = @client.star_gist(12345)
- success.should be_true
+ expect(success).to be_true
end
end
describe ".unstar_gist" do
- it "should unstar an existing gist" do
+ it "unstars an existing gist" do
stub_delete("/gists/12345/star").to_return(:status => 204)
success = @client.unstar_gist(12345)
- success.should be_true
+ expect(success).to be_true
end
end
describe ".gist_starred?" do
- it "should be starred" do
+ it "is starred" do
stub_get("/gists/12345/star").to_return(:status => 204)
starred = @client.gist_starred?(12345)
- starred.should be_true
+ expect(starred).to be_true
end
- it "should not be starred" do
+ it "is not starred" do
stub_get("/gists/12345/star").to_return(:status => 404)
starred = @client.gist_starred?(12345)
- starred.should be_false
+ expect(starred).to be_false
end
end
describe ".fork_gist" do
- it "should fork an existing gist" do
+ it "forks an existing gist" do
stub_post("/gists/12345/fork").
to_return(:body => fixture("v3/gist.json"))
gist = @client.fork_gist(12345)
- gist.user.login.should == @username
+ expect(gist.user.login).to eq(@username)
end
end
describe ".delete_gist" do
- it "should delete an existing gist" do
+ it "deletes an existing gist" do
stub_delete("/gists/12345").to_return(:status => 204)
deleted = @client.delete_gist(12345)
- deleted.should be_true
+ expect(deleted).to be_true
end
end
View
12 spec/octokit/client/issue_events_spec.rb
@@ -9,20 +9,20 @@
describe ".issue_events" do
- it "should list events for an issue" do
+ it "lists events for an issue" do
stub_get("/repos/pengwynn/octokit/issues/38/events").
to_return(:body => fixture("v3/issue_events.json"))
events = @client.issue_events("pengwynn/octokit", 38)
- events.first.event.should == "mentioned"
- events.last.actor.login.should == "ctshryock"
+ expect(events.first.event).to eq("mentioned")
+ expect(events.last.actor.login).to eq("ctshryock")
end
- it "should get a single event" do
+ it "gets a single event" do
stub_get("/repos/pengwynn/octokit/issues/events/3094334").
to_return(:body => fixture("v3/issue_event.json"))
events = @client.issue_event("pengwynn/octokit", 3094334)
- events.actor.login.should == "sferik"
- events.event.should == "closed"
+ expect(events.actor.login).to eq("sferik")
+ expect(events.event).to eq("closed")
end
end
View
60 spec/octokit/client/issues_spec.rb
@@ -9,153 +9,153 @@
describe ".search_issues" do
- it "should return matching issues" do
+ it "returns matching issues" do
stub_get("https://api.github.com/legacy/issues/search/sferik/rails_admin/open/activerecord").
to_return(:body => fixture("legacy/issues.json"))
issues = @client.search_issues("sferik/rails_admin", "activerecord")
- issues.first.number.should == 105
+ expect(issues.first.number).to eq(105)
end
end
describe ".list_issues" do
- it "should return issues for a repository" do
+ it "returns issues for a repository" do
stub_get("/repos/sferik/rails_admin/issues").
to_return(:body => fixture("v3/issues.json"))
issues = @client.issues("sferik/rails_admin")
- issues.first.number.should == 388
+ expect(issues.first.number).to eq(388)
end
- it "should return issues for the authenticated user" do
+ it "returns issues for the authenticated user" do
stub_get("/issues").
to_return(:body => fixture("v3/issues.json"))
issues = @client.issues
- issues.first.number.should == 388
+ expect(issues.first.number).to eq(388)
end
end
describe ".create_issue" do
- it "should create an issue" do
+ it "creates an issue" do
stub_post("/repos/ctshryock/octokit/issues").
with(:body => {"title" => "Migrate issues to v3", "body" => "Move all Issues calls to v3 of the API"},
:headers => {'Content-Type'=>'application/json'}).
to_return(:body => fixture("v3/issue.json"))
issue = @client.create_issue("ctshryock/octokit", "Migrate issues to v3", "Move all Issues calls to v3 of the API")
- issue.number.should == 12
+ expect(issue.number).to eq(12)
end
end
describe ".issue" do
- it "should return an issue" do
+ it "returns an issue" do
stub_get("/repos/ctshryock/octokit/issues/12").
to_return(:body => fixture("v3/issue.json"))
issue = @client.issue("ctshryock/octokit", 12)
- issue.number.should == 12
+ expect(issue.number).to eq(12)
end
end
describe ".close_issue" do
- it "should close an issue" do
+ it "closes an issue" do
stub_post("/repos/ctshryock/octokit/issues/12").
with(:body => {"state" => "closed"},
:headers => {'Content-Type'=>'application/json'}).
to_return(:body => fixture("v3/issue_closed.json"))
issue = @client.close_issue("ctshryock/octokit", 12)
- issue.number.should == 12
- issue.should include :closed_at
- issue.state.should == "closed"
+ expect(issue.number).to eq(12)
+ expect(issue).to include :closed_at
+ expect(issue.state).to eq("closed")
end
end
describe ".reopen_issue" do
- it "should reopen an issue" do
+ it "reopens an issue" do
stub_post("/repos/ctshryock/octokit/issues/12").
with(:body => {"state" => "open"},
:headers => {'Content-Type'=>'application/json'}).
to_return(:body => fixture("v3/issue.json"))
issue = @client.reopen_issue("ctshryock/octokit", 12)
- issue.number.should == 12
- issue.state.should == "open"
+ expect(issue.number).to eq(12)
+ expect(issue.state).to eq("open")
end
end
describe ".update_issue" do
- it "should update an issue" do
+ it "updates an issue" do
stub_post("/repos/ctshryock/octokit/issues/12").
with(:body => {"title" => "Use all the v3 api!", "body" => ""},
:headers => {'Content-Type'=>'application/json'}).
to_return(:body => fixture("v3/issue.json"))
issue = @client.update_issue("ctshryock/octokit", 12, "Use all the v3 api!", "")
- issue.number.should == 12
+ expect(issue.number).to eq(12)
end
end
describe ".issue_comments" do
- it "should return comments for an issue" do
+ it "returns comments for an issue" do
stub_get("/repos/pengwynn/octokit/issues/25/comments").
to_return(:status => 200, :body => fixture('v3/comments.json'))
comments = @client.issue_comments("pengwynn/octokit", 25)
- comments.first.user.login.should == "ctshryock"
+ expect(comments.first.user.login).to eq("ctshryock")
end
end
describe ".issue_comment" do
- it "should return a single comment for an issue" do
+ it "returns a single comment for an issue" do
stub_get("/repos/pengwynn/octokit/issues/comments/25").
to_return(:status => 200, :body => fixture('v3/comment.json'))
comments = @client.issue_comment("pengwynn/octokit", 25)
- comments.user.login.should == "ctshryock"
- comments.url.should == "https://api.github.com/repos/pengwynn/octokit/issues/comments/1194690"
+ expect(comments.user.login).to eq("ctshryock")
+ expect(comments.url).to eq("https://api.github.com/repos/pengwynn/octokit/issues/comments/1194690")
end
end
describe ".add_comment" do
- it "should add a comment" do
+ it "adds a comment" do
stub_post("/repos/pengwynn/octokit/issues/25/comments").
with(:body => {"body" => "A test comment"}).
to_return(:status => 201, :body => fixture('v3/comment.json'))
comment = @client.add_comment("pengwynn/octokit", 25, "A test comment")
- comment.user.login.should == "ctshryock"
+ expect(comment.user.login).to eq("ctshryock")
end
end
describe ".update_comment" do
- it "should update an existing comment" do
+ it "updates an existing comment" do
stub_post("/repos/pengwynn/octokit/issues/comments/1194549").
with(:body => {"body" => "A test comment update"}).
to_return(:status => 200, :body => fixture('v3/comment.json'))
comment = @client.update_comment("pengwynn/octokit", 1194549, "A test comment update")
- comment.user.login.should == "ctshryock"
+ expect(comment.user.login).to eq("ctshryock")
end
end
describe ".delete_comment" do
- it "should delete an existing comment" do
+ it "deletes an existing comment" do
stub_delete("/repos/pengwynn/octokit/issues/comments/1194549").
to_return(:status => 204)
comment = @client.delete_comment("pengwynn/octokit", 1194549)
- comment.status.should == 204
+ expect(comment.status).to eq(204)
end
end
View
56 spec/octokit/client/labels_spec.rb
@@ -9,143 +9,143 @@
describe ".labels" do
- it "should return labels" do
+ it "returns labels" do
stub_get("/repos/pengwynn/octokit/labels").
to_return(:body => fixture("v3/labels.json"))
labels = @client.labels("pengwynn/octokit")
- labels.first.name.should == "V3 Transition"
+ expect(labels.first.name).to eq("V3 Transition")
end
end
describe ".label" do
- it "should return a single labels" do
+ it "returns a single labels" do
stub_get("/repos/pengwynn/octokit/labels/V3+Addition").
to_return(:status => 200, :body => fixture('v3/label.json'))
label = @client.label("pengwynn/octokit", "V3 Addition")
- label.name.should == "V3 Addition"
+ expect(label.name).to eq("V3 Addition")
end
end
describe ".add_label" do
- it "should add a label with a color" do
+ it "adds a label with a color" do
stub_post("/repos/pengwynn/octokit/labels").
with(:body => {"name" => "a significant bug", "color" => "ededed"},
:headers => {'Content-Type'=>'application/json'}).
to_return(:status => 201, :body => fixture('v3/label.json'))
labels = @client.add_label("pengwynn/octokit", "a significant bug", 'ededed')
- labels.color.should == "ededed"
- labels.name.should == "V3 Addition"
+ expect(labels.color).to eq("ededed")
+ expect(labels.name).to eq("V3 Addition")
end
- it "should add a label with default color" do
+ it "adds a label with default color" do
stub_post("/repos/pengwynn/octokit/labels").
with(:body => {"name" => "another significant bug", "color" => "ffffff"},
:headers => {'Content-Type'=>'application/json'}).
to_return(:status => 201, :body => fixture('v3/label.json'))
labels = @client.add_label("pengwynn/octokit", "another significant bug")
- labels.color.should == "ededed"
- labels.name.should == "V3 Addition"
+ expect(labels.color).to eq("ededed")
+ expect(labels.name).to eq("V3 Addition")
end
end
describe ".update_label" do
- it "should update a label with a new color" do
+ it "updates a label with a new color" do
stub_post("/repos/pengwynn/octokit/labels/V3+Addition").
with(:body => {"color" => "ededed"},
:headers => {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => fixture('v3/label.json'))
label = @client.update_label("pengwynn/octokit", "V3 Addition", {:color => 'ededed'})
- label.color.should == 'ededed'
+ expect(label.color).to eq('ededed')
end
end
describe ".delete_label!" do
- it "should delete a label from the repository" do
+ it "deletes a label from the repository" do
stub_delete("/repos/pengwynn/octokit/labels/V3+Transition").
to_return(:status => 204)
response = @client.delete_label!("pengwynn/octokit", "V3 Transition")
- response.status.should == 204
+ expect(response.status).to eq(204)
end
end
describe ".remove_label" do
- it "should remove a label from the specified issue" do
+ it "removes a label from the specified issue" do
stub_delete("/repos/pengwynn/octokit/issues/23/labels/V3+Transition").
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
response = @client.remove_label("pengwynn/octokit", 23, "V3 Transition")
- response.last.name.should == 'Bug'
+ expect(response.last.name).to eq('Bug')
end
end
describe ".remove_all_labels" do
- it "should remove all labels from the specified issue" do
+ it "removes all labels from the specified issue" do
stub_delete("/repos/pengwynn/octokit/issues/23/labels").
to_return(:status => 204)
response = @client.remove_all_labels('pengwynn/octokit', 23)
- response.status.should == 204
+ expect(response.status).to eq(204)
end
end
describe ".add_labels_to_an_issue" do
- it "should add labels to a given issue" do
+ it "adds labels to a given issue" do
stub_post("/repos/pengwynn/octokit/issues/42/labels").
with(:body => '["V3 Transition","Bug"]',
:headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
labels = @client.add_labels_to_an_issue('pengwynn/octokit', 42, ['V3 Transition', 'Bug'])
- labels.first.name.should == 'V3 Transition'
- labels.last.name.should == 'Bug'
+ expect(labels.first.name).to eq('V3 Transition')
+ expect(labels.last.name).to eq('Bug')
end
end
describe ".replace_all_labels" do
- it "should replace all labels for an issue" do
+ it "replaces all labels for an issue" do
stub_put("/repos/pengwynn/octokit/issues/42/labels").
with(:body => '["V3 Transition","V3 Adding"]',
:headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
labels = @client.replace_all_labels('pengwynn/octokit', 42, ['V3 Transition', 'V3 Adding'])
- labels.first.name.should == 'V3 Transition'
+ expect(labels.first.name).to eq('V3 Transition')
end
end
describe ".lables_for_milestone" do
- it "should return all labels for a repository" do
+ it "returns all labels for a repository" do
stub_get('/repos/pengwynn/octokit/milestones/2/labels').
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
labels = @client.labels_for_milestone('pengwynn/octokit', 2)
- labels.size.should == 3
+ expect(labels.size).to eq(3)
end
end
describe ".labels_for_issue" do
- it "should return all labels for a given issue" do
+ it "returns all labels for a given issue" do
stub_get("/repos/pengwynn/octokit/issues/37/labels").
to_return(:status => 200, :body => fixture('v3/labels.json'), :headers => {})
labels = @client.labels_for_issue('pengwynn/octokit', 37)
- labels.first.name.should == 'V3 Transition'
- labels.last.name.should == 'Bug'
+ expect(labels.first.name).to eq('V3 Transition')
+ expect(labels.last.name).to eq('Bug')
end
end
View
4 spec/octokit/client/markdown_spec.rb
@@ -9,13 +9,13 @@
@client = Octokit::Client.new
end
- it "should render markdown" do
+ it "renders markdown" do
stub_post("/markdown").
to_return(:body => fixture("v3/markdown_gfm"))
text = "This is for #111"
markdown = @client.markdown(text, :context => 'pengwynn/octokit', :mode => 'gfm')
- markdown.should include('https://github.com/pengwynn/octokit/issues/111')
+ expect(markdown).to include('https://github.com/pengwynn/octokit/issues/111')
end
end
View
20 spec/octokit/client/milestones_spec.rb
@@ -9,57 +9,57 @@
describe ".list_milestones" do
- it "should list milestones belonging to repository" do
+ it "lists milestones belonging to repository" do
stub_get("/repos/pengwynn/octokit/milestones").
to_return(:status => 200, :body => fixture('v3/milestones.json'))
milestones = @client.list_milestones("pengwynn/octokit")
- milestones.first.description.should == "Add support for API v3"
+ expect(milestones.first.description).to eq("Add support for API v3")
end
end
describe ".milestone" do
- it "should get a single milestone belonging to repository" do
+ it "gets a single milestone belonging to repository" do
stub_get("/repos/pengwynn/octokit/milestones/1").
to_return(:status => 200, :body => fixture('v3/milestone.json'))
milestones = @client.milestone("pengwynn/octokit", 1)
- milestones.description.should == "Add support for API v3"
+ expect(milestones.description).to eq("Add support for API v3")
end
end
describe ".create_milestone" do
- it "should create a single milestone" do
+ it "creates a single milestone" do
stub_post("/repos/pengwynn/octokit/milestones").
with(:body => '{"title":"0.7.0"}', :headers => {'Content-Type'=>'application/json'}).
to_return(:status => 201, :body => fixture('v3/milestone.json'))
milestone = @client.create_milestone("pengwynn/octokit", "0.7.0")
- milestone.title.should == "0.7.0"
+ expect(milestone.title).to eq("0.7.0")
end
end
describe ".update_milestone" do
- it "should update a milestone" do
+ it "updates a milestone" do
stub_post("/repos/pengwynn/octokit/milestones/1").
with(:body => {"description" => "Add support for API v3"}, :headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => fixture('v3/milestone.json'))
milestone = @client.update_milestone("pengwynn/octokit", 1, {:description => "Add support for API v3"})
- milestone.description.should == "Add support for API v3"
+ expect(milestone.description).to eq("Add support for API v3")
end
end
describe ".delete_milestone" do
- it "should delete a milestone from a repository" do
+ it "deletes a milestone from a repository" do
stub_delete("/repos/pengwynn/octokit/milestones/2").
to_return(:status => 204, :body => "", :headers => {})
response = @client.delete_milestone("pengwynn/octokit", 2)
- response.status.should == 204
+ expect(response.status).to eq(204)
end
end
View
22 spec/octokit/client/objects_spec.rb
@@ -9,51 +9,51 @@
describe ".tree" do
- it "should return a tree" do
+ it "returns a tree" do
stub_get("https://api.github.com/repos/sferik/rails_admin/git/trees/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
to_return(:body => fixture("v3/tree.json"))
result = @client.tree("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
- result.sha.should == "3cdfabd973bc3caac209cba903cfdb3bf6636bcd"
- result.tree.first.path.should == ".gitignore"
+ expect(result.sha).to eq("3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
+ expect(result.tree.first.path).to eq(".gitignore")
end
end
describe ".create_tree" do
- it "should create a tree" do
+ it "creates a tree" do
stub_post("/repos/octocat/Hello-World/git/trees").
with(:body => { :tree => [ { :path => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ] },
:headers => { "Content-Type" => "application/json" }).
to_return(:body => fixture("v3/tree_create.json"))
response = @client.create_tree("octocat/Hello-World", [ { "path" => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ])
- response.sha.should == "cd8274d15fa3ae2ab983129fb037999f264ba9a7"
- response.tree.size.should == 1
- response.tree.first.sha.should == "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
+ expect(response.sha).to eq("cd8274d15fa3ae2ab983129fb037999f264ba9a7")
+ expect(response.tree.size).to eq(1)
+ expect(response.tree.first.sha).to eq("7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b")
end
end
describe ".blob" do
- it "should return a blob" do
+ it "returns a blob" do
stub_get("https://api.github.com/repos/sferik/rails_admin/git/blobs/94616fa57520ac8147522c7cf9f03d555595c5ea").
to_return(:body => fixture("v3/blob.json"))
blob = @client.blob("sferik/rails_admin", "94616fa57520ac8147522c7cf9f03d555595c5ea")
- blob.sha.should == "94616fa57520ac8147522c7cf9f03d555595c5ea"
+ expect(blob.sha).to eq("94616fa57520ac8147522c7cf9f03d555595c5ea")
end
end
describe ".create_blob" do
- it "should create a blob" do
+ it "creates a blob" do
stub_post("/repos/octocat/Hello-World/git/blobs").
with(:body => { :content => "content", :encoding => "utf-8" },
:headers => { "Content-Type" => "application/json" }).
to_return(:body => fixture("v3/blob_create.json"))
blob = @client.create_blob("octocat/Hello-World", "content")
- blob.should == "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
+ expect(blob).to eq("3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15")
end
end
View
82 spec/octokit/client/organizations_spec.rb
@@ -9,23 +9,23 @@
describe ".organization" do
- it "should return an organization" do
+ it "returns an organization" do
stub_get("https://api.github.com/orgs/codeforamerica").
to_return(:body => fixture("v3/organization.json"))
organization = @client.organization("codeforamerica")
- organization.name.should == "Code For America"
+ expect(organization.name).to eq("Code For America")
end
end
describe ".update_organization" do
- it "should update an organization" do
+ it "updates an organization" do
stub_patch("https://api.github.com/orgs/codeforamerica").
with(:name => "Code For America").
to_return(:body => fixture("v3/organization.json"))
organization = @client.update_organization("codeforamerica", {:name => "Code For America"})
- organization.name.should == "Code For America"
+ expect(organization.name).to eq("Code For America")
end
end
@@ -34,22 +34,22 @@
context "with a user passed" do
- it "should return all organizations for a user" do
+ it "returns all organizations for a user" do
stub_get("https://api.github.com/users/sferik/orgs").
to_return(:body => fixture("v3/organizations.json"))
organizations = @client.organizations("sferik")
- organizations.first.login.should == "Hubcap"
+ expect(organizations.first.login).to eq("Hubcap")
end
end
context "without user passed" do
- it "should return all organizations for a user" do
+ it "returns all organizations for a user" do
stub_get("https://api.github.com/user/orgs").
to_return(:body => fixture("v3/organizations.json"))
organizations = @client.organizations
- organizations.first.login.should == "Hubcap"
+ expect(organizations.first.login).to eq("Hubcap")
end
end
@@ -58,79 +58,79 @@
describe ".organization_repositories" do
- it "should return all public repositories for an organization" do
+ it "returns all public repositories for an organization" do
stub_get("https://api.github.com/orgs/codeforamerica/repos").
to_return(:body => fixture("v3/organization-repositories.json"))
repositories = @client.organization_repositories("codeforamerica")
- repositories.first.name.should == "cfahelloworld"
+ expect(repositories.first.name).to eq("cfahelloworld")
end
end
describe ".organization_members" do
- it "should return all public members of an organization" do
+ it "returns all public members of an organization" do
stub_get("https://api.github.com/orgs/codeforamerica/members").
to_return(:body => fixture("v3/organization_members.json"))
users = @client.organization_members("codeforamerica")
- users.first.login.should == "akit"
+ expect(users.first.login).to eq("akit")
end
end
describe ".organization_teams" do
- it "should return all teams for an organization" do
+ it "returns all teams for an organization" do
stub_get("https://api.github.com/orgs/codeforamerica/teams").
to_return(:body => fixture("v3/teams.json"))
teams = @client.organization_teams("codeforamerica")
- teams.first.name.should == "Fellows"
+ expect(teams.first.name).to eq("Fellows")
end
end
describe ".create_team" do
- it "should create a team" do
+ it "creates a team" do
stub_post("https://api.github.com/orgs/codeforamerica/teams").
with(:name => "Fellows").
to_return(:body => fixture("v3/team.json"))
team = @client.create_team("codeforamerica", {:name => "Fellows"})
- team.name.should == "Fellows"
+ expect(team.name).to eq("Fellows")
end
end
describe ".team" do
- it "should return a team" do
+ it "returns a team" do
stub_get("https://api.github.com/teams/32598").
to_return(:body => fixture("v3/team.json"))
team = @client.team(32598)
- team.name.should == "Fellows"
+ expect(team.name).to eq("Fellows")
end
end
describe ".update_team" do
- it "should update a team" do
+ it "updates a team" do
stub_patch("https://api.github.com/teams/32598").
with(:name => "Fellows").
to_return(:body => fixture("v3/team.json"))
team = @client.update_team(32598, :name => "Fellows")
- team.name.should == "Fellows"
+ expect(team.name).to eq("Fellows")
end
end
describe ".delete_team" do
- it "should delete a team" do
+ it "deletes a team" do
stub_delete("https://api.github.com/teams/32598").
to_return(:status => 204)
result = @client.delete_team(32598)
- result.status.should == 204
+ expect(result.status).to eq(204)
end
end
@@ -138,102 +138,102 @@
describe ".team_members" do
- it "should return team members" do
+ it "returns team members" do
stub_get("https://api.github.com/teams/33239/members").
to_return(:body => fixture("v3/organization_team_members.json"))
users = @client.team_members(33239)
- users.first.login.should == "ctshryock"
+ expect(users.first.login).to eq("ctshryock")
end
end
describe ".add_team_member" do
- it "should add a team member" do
+ it "adds a team member" do
stub_put("https://api.github.com/teams/32598/members/sferik").
with(:name => "sferik").
to_return(:status => 204)
result = @client.add_team_member(32598, "sferik")
- result.should be_true
+ expect(result).to be_true
end
end
describe ".remove_team_member" do
- it "should remove a team member" do
+ it "removes a team member" do
stub_delete("https://api.github.com/teams/32598/members/sferik").
to_return(:status => 204)
result = @client.remove_team_member(32598, "sferik")
- result.should be_true
+ expect(result).to be_true
end
end
describe ".remove_organization_member" do
- it "should remove a member from an organization" do
+ it "removes a member from an organization" do
stub_delete("https://api.github.com/orgs/codeforamerica/members/glow-mdsol").
to_return(:status => 204)
result = @client.remove_organization_member("codeforamerica", "glow-mdsol")
- result.should be_true
+ expect(result).to be_true
end
end
describe ".team_repositories" do
- it "should return team repositories" do
+ it "returns team repositories" do
stub_get("https://api.github.com/teams/33239/repos").
to_return(:body => fixture("v3/organization_team_repos.json"))
repositories = @client.team_repositories(33239)
- repositories.first.name.should == "GitTalk"
- repositories.first.owner.id.should == 570695
+ expect(repositories.first.name).to eq("GitTalk")
+ expect(repositories.first.owner.id).to eq(570695)
end
end
describe ".add_team_repository" do
- it "should add a team repository" do
+ it "adds a team repository" do
stub_put("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
with(:name => "reddavis/One40Proof").
to_return(:status => 204)
result = @client.add_team_repository(32598, "reddavis/One40Proof")
- result.should be_true
+ expect(result).to be_true
end
end
describe ".remove_team_repository" do
- it "should remove a team repository" do
+ it "removes a team repository" do
stub_delete("https://api.github.com/teams/32598/repos/reddavis/One40Proof").
to_return(:status => 204)
result = @client.remove_team_repository(32598, "reddavis/One40Proof")
- result.should be_true
+ expect(result).to be_true
end
end
describe ".publicize_membership" do
- it "should pulicize membership" do
+ it "pulicizes membership" do
stub_put("https://api.github.com/orgs/codeforamerica/public_members/sferik").
with(:name => "sferik").
to_return(:status => 204)
result = @client.publicize_membership("codeforamerica", "sferik")
- result.should be_true
+ expect(result).to be_true
end
end
describe ".unpublicize_membership" do
- it "should unpulicize membership" do
+ it "unpulicizes membership" do
stub_delete("https://api.github.com/orgs/codeforamerica/public_members/sferik").
with(:name => "sferik").
to_return(:status => 204)
result = @client.unpublicize_membership("codeforamerica", "sferik")
- result.should be_true
+ expect(result).to be_true
end
end
View
4 spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb
@@ -18,7 +18,7 @@
with(subscribe_request_body).
to_return(:body => nil)
- client.subscribe_service_hook("joshk/completeness-fu", "Travis", { :token => 'travistoken' }).should == true
+ expect(client.subscribe_service_hook("joshk/completeness-fu", "Travis", { :token => 'travistoken' })).to eq(true)
assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => subscribe_request_body, :times => 1
end
end
@@ -37,7 +37,7 @@
with(unsubscribe_request_body).
to_return(:body => nil)
- client.unsubscribe_service_hook("joshk/completeness-fu", "Travis").should == true
+ expect(client.unsubscribe_service_hook("joshk/completeness-fu", "Travis")).to eq(true)
assert_requested :post, "https://api.github.com/hub?access_token=myfaketoken", :body => unsubscribe_request_body, :times => 1
end
end
View
8 spec/octokit/client/pub_sub_hubbub_spec.rb
@@ -14,7 +14,7 @@
}).
to_return(:body => nil)
- client.subscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").should == true
+ expect(client.subscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken")).to eq(true)
end
it "raises an error if the topic is not recognized" do
@@ -26,9 +26,9 @@
}).
to_return(:status => 422)
- proc {
+ expect {
client.subscribe("https://github.com/joshk/completeness-fud/events/push", "github://Travis?token=travistoken")
- }.should raise_exception
+ }.to raise_exception
end
end
@@ -42,7 +42,7 @@
}).
to_return(:body => nil)
- client.unsubscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken").should == true
+ expect(client.unsubscribe("https://github.com/joshk/completeness-fu/events/push", "github://Travis?token=travistoken")).to eq(true)
end
end
View
40 spec/octokit/client/pulls_spec.rb
@@ -9,105 +9,105 @@
describe ".create_pull_request" do
- it "should create a pull request" do
+ it "creates a pull request" do
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
with(:pull => {:base => "master", :head => "pengwynn:master", :title => "Title", :body => "Body"}).
to_return(:body => fixture("v3/pull_created.json"))
pull = @client.create_pull_request("pengwynn/octokit", "master", "pengwynn:master", "Title", "Body")
- pull.number.should == 15
- pull.title.should == "Pull this awesome v3 stuff"
+ expect(pull.number).to eq(15)
+ expect(pull.title).to eq("Pull this awesome v3 stuff")
end
end
describe ".create_pull_request_for_issue" do
- it "should create a pull request and attach it to an existing issue" do
+ it "creates a pull request and attach it to an existing issue" do
stub_post("https://api.github.com/repos/pengwynn/octokit/pulls").
with(:pull => {:base => "master", :head => "pengwynn:octokit", :issue => "15"}).
to_return(:body => fixture("v3/pull_created.json"))
pull = @client.create_pull_request_for_issue("pengwynn/octokit", "master", "pengwynn:octokit", "15")
- pull.number.should == 15
+ expect(pull.number).to eq(15)
end
end
describe ".pull_requests" do
- it "should return all pull requests" do
+ it "returns all pull requests" do
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls?state=open").
to_return(:body => fixture("v3/pull_requests.json"))
pulls = @client.pulls("pengwynn/octokit")
- pulls.first.number.should == 928
+ expect(pulls.first.number).to eq(928)
end
end
describe ".pull_request" do
- it "should return a pull request" do
+ it "returns a pull request" do
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67").
to_return(:body => fixture("v3/pull_request.json"))
pull = @client.pull("pengwynn/octokit", 67)
- pull.number.should == 67
+ expect(pull.number).to eq(67)
end
end
describe ".pull_request_commits" do
- it "should return the commits for a pull request" do
+ it "returns the commits for a pull request" do
stub_get("https://api.github.com/repos/pengwynn/octokit/pulls/67/commits").
to_return(:body => fixture("v3/pull_request_commits.json"))
commits = @client.pull_commits("pengwynn/octokit", 67)
- commits.first["sha"].should == "2097821c7c5aa4dc02a2cc54d5ca51968b373f95"
+ expect(commits.first["sha"]).to eq("2097821c7c5aa4dc02a2cc54d5ca51968b373f95")
end
end
describe ".pull_request_comments" do
- it "should return the comments for a pull request" do