gems 0.8.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +3 -3
- data/README.md +11 -23
- data/gems.gemspec +12 -16
- data/lib/gems.rb +7 -3
- data/lib/gems/client.rb +47 -60
- data/lib/gems/configuration.rb +7 -7
- data/lib/gems/request.rb +26 -22
- data/lib/gems/version.rb +3 -3
- metadata +28 -105
- data.tar.gz.sig +0 -2
- data/Rakefile +0 -11
- data/spec/fixtures/add_owner +0 -1
- data/spec/fixtures/add_web_hook +0 -1
- data/spec/fixtures/api_key +0 -1
- data/spec/fixtures/dependencies +0 -0
- data/spec/fixtures/downloads.yaml +0 -91
- data/spec/fixtures/fire_web_hook +0 -1
- data/spec/fixtures/gems-0.0.8.gem +0 -0
- data/spec/fixtures/gems.yaml +0 -1072
- data/spec/fixtures/just_updated.yaml +0 -1376
- data/spec/fixtures/latest.yaml +0 -1098
- data/spec/fixtures/most_downloaded.yaml +0 -20
- data/spec/fixtures/most_downloaded_today.yaml +0 -1053
- data/spec/fixtures/owners.yaml +0 -2
- data/spec/fixtures/push +0 -1
- data/spec/fixtures/rails.yaml +0 -33
- data/spec/fixtures/rails_admin-0.0.0.yaml +0 -3
- data/spec/fixtures/remove_owner +0 -1
- data/spec/fixtures/remove_web_hook +0 -1
- data/spec/fixtures/reverse_dependencies_short.yaml +0 -70
- data/spec/fixtures/script_helpers.yaml +0 -17
- data/spec/fixtures/search.yaml +0 -898
- data/spec/fixtures/total_downloads.yaml +0 -2
- data/spec/fixtures/unyank +0 -1
- data/spec/fixtures/web_hooks.yaml +0 -4
- data/spec/fixtures/yank +0 -1
- data/spec/gems/client_spec.rb +0 -432
- data/spec/gems/request_spec.rb +0 -31
- data/spec/gems_spec.rb +0 -73
- data/spec/helper.rb +0 -64
- metadata.gz.sig +0 -0
data/spec/gems_spec.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
describe Gems do
|
4
|
-
after do
|
5
|
-
Gems.reset
|
6
|
-
end
|
7
|
-
|
8
|
-
context "when delegating to a client" do
|
9
|
-
before do
|
10
|
-
stub_get("/api/v1/gems/rails.yaml").
|
11
|
-
to_return(:body => fixture("rails.yaml"))
|
12
|
-
end
|
13
|
-
|
14
|
-
it "gets the correct resource" do
|
15
|
-
Gems.info('rails')
|
16
|
-
expect(a_get("/api/v1/gems/rails.yaml")).to have_been_made
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns the same results as a client" do
|
20
|
-
expect(Gems.info('rails')).to eq Gems::Client.new.info('rails')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '.respond_to?' do
|
25
|
-
it "takes an optional argument" do
|
26
|
-
expect(Gems.respond_to?(:new, true)).to be_true
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe ".new" do
|
31
|
-
it "returns a Gems::Client" do
|
32
|
-
expect(Gems.new).to be_a Gems::Client
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe ".host" do
|
37
|
-
it "returns the default host" do
|
38
|
-
expect(Gems.host).to eq Gems::Configuration::DEFAULT_HOST
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe ".host=" do
|
43
|
-
it "sets the host" do
|
44
|
-
Gems.host = 'http://localhost:3000'
|
45
|
-
expect(Gems.host).to eq 'http://localhost:3000'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe ".user_agent" do
|
50
|
-
it "returns the default user agent" do
|
51
|
-
expect(Gems.user_agent).to eq Gems::Configuration::DEFAULT_USER_AGENT
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe ".user_agent=" do
|
56
|
-
it "sets the user agent" do
|
57
|
-
Gems.user_agent = 'Custom User Agent'
|
58
|
-
expect(Gems.user_agent).to eq 'Custom User Agent'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe ".configure" do
|
63
|
-
Gems::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
64
|
-
it "sets the #{key}" do
|
65
|
-
Gems.configure do |config|
|
66
|
-
config.send("#{key}=", key)
|
67
|
-
expect(Gems.send(key)).to eq key
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
data/spec/helper.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
require 'coveralls'
|
3
|
-
|
4
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
-
SimpleCov::Formatter::HTMLFormatter,
|
6
|
-
Coveralls::SimpleCov::Formatter
|
7
|
-
]
|
8
|
-
SimpleCov.start
|
9
|
-
|
10
|
-
require 'gems'
|
11
|
-
require 'rspec'
|
12
|
-
require 'webmock/rspec'
|
13
|
-
|
14
|
-
WebMock.disable_net_connect!(:allow => 'coveralls.io')
|
15
|
-
|
16
|
-
RSpec.configure do |config|
|
17
|
-
config.expect_with :rspec do |c|
|
18
|
-
c.syntax = :expect
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def rubygems_url(url)
|
23
|
-
url =~ /^http/ ? url : 'https://rubygems.org' + url
|
24
|
-
end
|
25
|
-
|
26
|
-
def a_delete(url)
|
27
|
-
a_request(:delete, rubygems_url(url))
|
28
|
-
end
|
29
|
-
|
30
|
-
def a_get(url)
|
31
|
-
a_request(:get, rubygems_url(url))
|
32
|
-
end
|
33
|
-
|
34
|
-
def a_post(url)
|
35
|
-
a_request(:post, rubygems_url(url))
|
36
|
-
end
|
37
|
-
|
38
|
-
def a_put(url)
|
39
|
-
a_request(:put, rubygems_url(url))
|
40
|
-
end
|
41
|
-
|
42
|
-
def stub_delete(url)
|
43
|
-
stub_request(:delete, rubygems_url(url))
|
44
|
-
end
|
45
|
-
|
46
|
-
def stub_get(url)
|
47
|
-
stub_request(:get, rubygems_url(url))
|
48
|
-
end
|
49
|
-
|
50
|
-
def stub_post(url)
|
51
|
-
stub_request(:post, rubygems_url(url))
|
52
|
-
end
|
53
|
-
|
54
|
-
def stub_put(url)
|
55
|
-
stub_request(:put, rubygems_url(url))
|
56
|
-
end
|
57
|
-
|
58
|
-
def fixture_path
|
59
|
-
File.expand_path('../fixtures', __FILE__)
|
60
|
-
end
|
61
|
-
|
62
|
-
def fixture(file)
|
63
|
-
File.new(fixture_path + '/' + file)
|
64
|
-
end
|
metadata.gz.sig
DELETED
Binary file
|