-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #2.
- Loading branch information
Showing
5 changed files
with
33 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,6 @@ | |
|
||
describe Gems::Client do | ||
before do | ||
Gems.configure do |config| | ||
config.key = '701243f217cdf23b1370c7b66b65ca97' | ||
config.username = '[email protected]' | ||
config.password = 'schwwwwing' | ||
end | ||
end | ||
|
||
after do | ||
Gems.reset | ||
end | ||
|
||
|
@@ -149,13 +141,17 @@ | |
|
||
describe ".api_key" do | ||
before do | ||
stub_get("/api/v1/api_key"). | ||
Gems.configure do |config| | ||
config.username = '[email protected]' | ||
config.password = 'schwwwwing' | ||
end | ||
stub_get("https://nick%40gemcutter.org:[email protected]/api/v1/api_key"). | ||
to_return(:body => fixture("api_key")) | ||
end | ||
|
||
it "should retrieve an API key" do | ||
api_key = Gems.api_key | ||
a_get("/api/v1/api_key"). | ||
a_get("https://nick%40gemcutter.org:[email protected]/api/v1/api_key"). | ||
should have_been_made | ||
api_key.should == "701243f217cdf23b1370c7b66b65ca97" | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,8 @@ | |
describe Gems do | ||
context "when delegating to a client" do | ||
before do | ||
Gems.configure do |config| | ||
config.username = '[email protected]' | ||
config.password = 'schwwwwing' | ||
end | ||
stub_get("/api/v1/gems/rails.json").to_return(:body => fixture("rails.json")) | ||
end | ||
|
||
after do | ||
stub_get("/api/v1/gems/rails.json"). | ||
to_return(:body => fixture("rails.json")) | ||
Gems.reset | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,36 +6,40 @@ | |
require 'rspec' | ||
require 'webmock/rspec' | ||
|
||
def a_delete(path) | ||
a_request(:delete, 'https://nick%40gemcutter.org:schwwwwing@rubygems.org' + path) | ||
def rubygems_url(url) | ||
url =~ /^http/ ? url : 'https://rubygems.org' + url | ||
end | ||
|
||
def a_get(path) | ||
a_request(:get, 'https://nick%40gemcutter.org:[email protected]' + path) | ||
def a_delete(url) | ||
a_request(:delete, rubygems_url(url)) | ||
end | ||
|
||
def a_post(path) | ||
a_request(:post, 'https://nick%40gemcutter.org:[email protected]' + path) | ||
def a_get(url) | ||
a_request(:get, rubygems_url(url)) | ||
end | ||
|
||
def a_put(path) | ||
a_request(:put, 'https://nick%40gemcutter.org:[email protected]' + path) | ||
def a_post(url) | ||
a_request(:post, rubygems_url(url)) | ||
end | ||
|
||
def stub_delete(path) | ||
stub_request(:delete, 'https://nick%40gemcutter.org:[email protected]' + path) | ||
def a_put(url) | ||
a_request(:put, rubygems_url(url)) | ||
end | ||
|
||
def stub_get(path) | ||
stub_request(:get, 'https://nick%40gemcutter.org:[email protected]' + path) | ||
def stub_delete(url) | ||
stub_request(:delete, rubygems_url(url)) | ||
end | ||
|
||
def stub_post(path) | ||
stub_request(:post, 'https://nick%40gemcutter.org:[email protected]' + path) | ||
def stub_get(url) | ||
stub_request(:get, rubygems_url(url)) | ||
end | ||
|
||
def stub_put(path) | ||
stub_request(:put, 'https://nick%40gemcutter.org:[email protected]' + path) | ||
def stub_post(url) | ||
stub_request(:post, rubygems_url(url)) | ||
end | ||
|
||
def stub_put(url) | ||
stub_request(:put, rubygems_url(url)) | ||
end | ||
|
||
def fixture_path | ||
|