artifactory 2.5.2 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +9 -13
  5. data/README.md +10 -1
  6. data/Rakefile +16 -7
  7. data/appveyor.yml +4 -2
  8. data/artifactory.gemspec +14 -14
  9. data/lib/artifactory.rb +26 -26
  10. data/lib/artifactory/client.rb +25 -23
  11. data/lib/artifactory/configurable.rb +1 -0
  12. data/lib/artifactory/defaults.rb +24 -15
  13. data/lib/artifactory/errors.rb +2 -2
  14. data/lib/artifactory/resources/artifact.rb +34 -33
  15. data/lib/artifactory/resources/backup.rb +5 -5
  16. data/lib/artifactory/resources/base.rb +7 -7
  17. data/lib/artifactory/resources/build.rb +15 -15
  18. data/lib/artifactory/resources/build_component.rb +4 -4
  19. data/lib/artifactory/resources/group.rb +4 -4
  20. data/lib/artifactory/resources/layout.rb +3 -3
  21. data/lib/artifactory/resources/ldap_setting.rb +7 -6
  22. data/lib/artifactory/resources/mail_server.rb +3 -3
  23. data/lib/artifactory/resources/permission_target.rb +20 -20
  24. data/lib/artifactory/resources/plugin.rb +1 -1
  25. data/lib/artifactory/resources/repository.rb +20 -20
  26. data/lib/artifactory/resources/system.rb +6 -6
  27. data/lib/artifactory/resources/url_base.rb +4 -3
  28. data/lib/artifactory/resources/user.rb +4 -4
  29. data/lib/artifactory/util.rb +10 -10
  30. data/lib/artifactory/version.rb +1 -1
  31. data/spec/integration/resources/artifact_spec.rb +31 -31
  32. data/spec/integration/resources/backup.rb +7 -7
  33. data/spec/integration/resources/build_component_spec.rb +18 -18
  34. data/spec/integration/resources/build_spec.rb +15 -15
  35. data/spec/integration/resources/group_spec.rb +16 -16
  36. data/spec/integration/resources/layout_spec.rb +7 -7
  37. data/spec/integration/resources/ldap_setting_spec.rb +7 -7
  38. data/spec/integration/resources/mail_server_spec.rb +7 -7
  39. data/spec/integration/resources/permission_target_spec.rb +35 -35
  40. data/spec/integration/resources/repository_spec.rb +14 -14
  41. data/spec/integration/resources/system_spec.rb +20 -21
  42. data/spec/integration/resources/url_base_spec.rb +7 -7
  43. data/spec/integration/resources/user_spec.rb +16 -16
  44. data/spec/spec_helper.rb +11 -11
  45. data/spec/support/api_server.rb +13 -13
  46. data/spec/support/api_server/artifact_endpoints.rb +94 -94
  47. data/spec/support/api_server/build_component_endpoints.rb +18 -18
  48. data/spec/support/api_server/build_endpoints.rb +76 -76
  49. data/spec/support/api_server/group_endpoints.rb +24 -24
  50. data/spec/support/api_server/permission_target_endpoints.rb +24 -24
  51. data/spec/support/api_server/repository_endpoints.rb +82 -82
  52. data/spec/support/api_server/status_endpoints.rb +5 -5
  53. data/spec/support/api_server/system_endpoints.rb +17 -18
  54. data/spec/support/api_server/user_endpoints.rb +30 -30
  55. data/spec/unit/artifactory_spec.rb +17 -17
  56. data/spec/unit/client_spec.rb +43 -43
  57. data/spec/unit/resources/artifact_spec.rb +256 -256
  58. data/spec/unit/resources/backup_spec.rb +8 -8
  59. data/spec/unit/resources/base_spec.rb +51 -51
  60. data/spec/unit/resources/build_component_spec.rb +45 -45
  61. data/spec/unit/resources/build_spec.rb +98 -98
  62. data/spec/unit/resources/defaults_spec.rb +4 -4
  63. data/spec/unit/resources/group_spec.rb +36 -36
  64. data/spec/unit/resources/layout_spec.rb +8 -8
  65. data/spec/unit/resources/ldap_setting_spec.rb +8 -8
  66. data/spec/unit/resources/mail_server_spec.rb +8 -8
  67. data/spec/unit/resources/permission_target_spec.rb +79 -79
  68. data/spec/unit/resources/plugin_spec.rb +7 -7
  69. data/spec/unit/resources/repository_spec.rb +98 -98
  70. data/spec/unit/resources/system_spec.rb +30 -30
  71. data/spec/unit/resources/url_base_spec.rb +8 -8
  72. data/spec/unit/resources/user_spec.rb +40 -40
  73. metadata +3 -3
@@ -1,112 +1,112 @@
1
1
  module Artifactory
2
2
  module APIServer::RepositoryEndpoints
3
3
  def self.registered(app)
4
- app.get('/api/repositories') do
5
- content_type 'application/vnd.org.jfrog.artifactory.repositories.RepositoryDetailsList+json'
4
+ app.get("/api/repositories") do
5
+ content_type "application/vnd.org.jfrog.artifactory.repositories.RepositoryDetailsList+json"
6
6
  JSON.fast_generate([
7
7
  {
8
- 'key' => 'libs-release-local',
9
- 'type' => 'LOCAL',
10
- 'description' => 'Local repository for in-house libraries',
11
- 'url' => server_url.join('libs-release-local'),
8
+ "key" => "libs-release-local",
9
+ "type" => "LOCAL",
10
+ "description" => "Local repository for in-house libraries",
11
+ "url" => server_url.join("libs-release-local"),
12
12
  },
13
13
  {
14
- 'key' => 'libs-snapshots-local',
15
- 'type' => 'LOCAL',
16
- 'description' => 'Local repository for in-house snapshots',
17
- 'url' => server_url.join('libs-snapshots-local'),
14
+ "key" => "libs-snapshots-local",
15
+ "type" => "LOCAL",
16
+ "description" => "Local repository for in-house snapshots",
17
+ "url" => server_url.join("libs-snapshots-local"),
18
18
  },
19
19
  ])
20
20
  end
21
21
 
22
- app.get('/api/repositories/libs-release-local') do
23
- content_type 'application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json'
22
+ app.get("/api/repositories/libs-release-local") do
23
+ content_type "application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json"
24
24
  JSON.fast_generate({
25
- 'key' => 'libs-release-local',
26
- 'description' => 'Local repository for in-house libraries',
27
- 'notes' => '',
28
- 'includesPattern' => '**/*',
29
- 'excludesPattern' => '',
30
- 'repoLayoutRef' => 'simple-default',
31
- 'enableNuGetSupport' => false,
32
- 'enableGemsSupport' => false,
33
- 'checksumPolicyType' => 'client-checksums',
34
- 'handleReleases' => true,
35
- 'handleSnapshots' => false,
36
- 'maxUniqueSnapshots' => 0,
37
- 'snapshotVersionBehavior' => 'unique',
38
- 'suppressPomConsistencyChecks' => false,
39
- 'blackedOut' => false,
40
- 'propertySets' => ['artifactory'],
41
- 'archiveBrowsingEnabled' => false,
42
- 'calculateYumMetadata' => false,
43
- 'yumRootDepth' => 0,
44
- 'rclass' => 'local',
45
- 'packageType' => 'generic'
25
+ "key" => "libs-release-local",
26
+ "description" => "Local repository for in-house libraries",
27
+ "notes" => "",
28
+ "includesPattern" => "**/*",
29
+ "excludesPattern" => "",
30
+ "repoLayoutRef" => "simple-default",
31
+ "enableNuGetSupport" => false,
32
+ "enableGemsSupport" => false,
33
+ "checksumPolicyType" => "client-checksums",
34
+ "handleReleases" => true,
35
+ "handleSnapshots" => false,
36
+ "maxUniqueSnapshots" => 0,
37
+ "snapshotVersionBehavior" => "unique",
38
+ "suppressPomConsistencyChecks" => false,
39
+ "blackedOut" => false,
40
+ "propertySets" => ["artifactory"],
41
+ "archiveBrowsingEnabled" => false,
42
+ "calculateYumMetadata" => false,
43
+ "yumRootDepth" => 0,
44
+ "rclass" => "local",
45
+ "packageType" => "generic",
46
46
  })
47
47
  end
48
48
 
49
- app.get('/api/repositories/libs-snapshots-local') do
50
- content_type 'application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json'
49
+ app.get("/api/repositories/libs-snapshots-local") do
50
+ content_type "application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json"
51
51
  JSON.fast_generate({
52
- 'key' => 'libs-snapshots-local',
53
- 'description' => 'Local repository for in-house snapshots',
54
- 'notes' => '',
55
- 'includesPattern' => '**/*',
56
- 'excludesPattern' => '',
57
- 'repoLayoutRef' => 'simple-default',
58
- 'enableNuGetSupport' => false,
59
- 'enableGemsSupport' => false,
60
- 'checksumPolicyType' => 'client-checksums',
61
- 'handleReleases' => false,
62
- 'handleSnapshots' => true,
63
- 'maxUniqueSnapshots' => 10,
64
- 'snapshotVersionBehavior' => 'unique',
65
- 'suppressPomConsistencyChecks' => false,
66
- 'blackedOut' => false,
67
- 'propertySets' => ['artifactory'],
68
- 'archiveBrowsingEnabled' => false,
69
- 'calculateYumMetadata' => false,
70
- 'yumRootDepth' => 0,
71
- 'rclass' => 'local',
72
- 'packageType' => 'generic'
52
+ "key" => "libs-snapshots-local",
53
+ "description" => "Local repository for in-house snapshots",
54
+ "notes" => "",
55
+ "includesPattern" => "**/*",
56
+ "excludesPattern" => "",
57
+ "repoLayoutRef" => "simple-default",
58
+ "enableNuGetSupport" => false,
59
+ "enableGemsSupport" => false,
60
+ "checksumPolicyType" => "client-checksums",
61
+ "handleReleases" => false,
62
+ "handleSnapshots" => true,
63
+ "maxUniqueSnapshots" => 10,
64
+ "snapshotVersionBehavior" => "unique",
65
+ "suppressPomConsistencyChecks" => false,
66
+ "blackedOut" => false,
67
+ "propertySets" => ["artifactory"],
68
+ "archiveBrowsingEnabled" => false,
69
+ "calculateYumMetadata" => false,
70
+ "yumRootDepth" => 0,
71
+ "rclass" => "local",
72
+ "packageType" => "generic",
73
73
  })
74
74
  end
75
75
 
76
- app.get('/api/repositories/libs-debian-local') do
77
- content_type 'application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json'
76
+ app.get("/api/repositories/libs-debian-local") do
77
+ content_type "application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json"
78
78
  JSON.fast_generate({
79
- 'key' => 'libs-debian-local',
80
- 'description' => 'Local repository for in-house snapshots',
81
- 'notes' => '',
82
- 'includesPattern' => '**/*',
83
- 'excludesPattern' => '',
84
- 'repoLayoutRef' => 'simple-default',
85
- 'enableNuGetSupport' => false,
86
- 'enableGemsSupport' => false,
87
- 'checksumPolicyType' => 'client-checksums',
88
- 'handleReleases' => false,
89
- 'handleSnapshots' => true,
90
- 'maxUniqueSnapshots' => 10,
91
- 'snapshotVersionBehavior' => 'unique',
92
- 'suppressPomConsistencyChecks' => false,
93
- 'blackedOut' => false,
94
- 'propertySets' => ['artifactory'],
95
- 'archiveBrowsingEnabled' => false,
96
- 'calculateYumMetadata' => false,
97
- 'yumRootDepth' => 0,
98
- 'rclass' => 'local',
99
- 'packageType' => 'debian'
79
+ "key" => "libs-debian-local",
80
+ "description" => "Local repository for in-house snapshots",
81
+ "notes" => "",
82
+ "includesPattern" => "**/*",
83
+ "excludesPattern" => "",
84
+ "repoLayoutRef" => "simple-default",
85
+ "enableNuGetSupport" => false,
86
+ "enableGemsSupport" => false,
87
+ "checksumPolicyType" => "client-checksums",
88
+ "handleReleases" => false,
89
+ "handleSnapshots" => true,
90
+ "maxUniqueSnapshots" => 10,
91
+ "snapshotVersionBehavior" => "unique",
92
+ "suppressPomConsistencyChecks" => false,
93
+ "blackedOut" => false,
94
+ "propertySets" => ["artifactory"],
95
+ "archiveBrowsingEnabled" => false,
96
+ "calculateYumMetadata" => false,
97
+ "yumRootDepth" => 0,
98
+ "rclass" => "local",
99
+ "packageType" => "debian",
100
100
  })
101
101
  end
102
102
 
103
103
  # Simulate a non-existent repository
104
- app.get('/api/repositories/libs-testing-local') do
104
+ app.get("/api/repositories/libs-testing-local") do
105
105
  status 400
106
106
  end
107
107
 
108
- app.put('/api/repositories/libs-testing-local') do
109
- content_type 'text/plain'
108
+ app.put("/api/repositories/libs-testing-local") do
109
+ content_type "text/plain"
110
110
  "Repository libs-resting-local created successfully!\n"
111
111
  end
112
112
  end
@@ -1,11 +1,11 @@
1
1
  module Artifactory
2
2
  module APIServer::StatusEndpoints
3
3
  def self.registered(app)
4
- app.get('/status/:code') { code.to_i }
5
- app.post('/status/:code') { code.to_i }
6
- app.patch('/status/:code') { code.to_i }
7
- app.put('/status/:code') { code.to_i }
8
- app.delete('/status/:code') { code.to_i }
4
+ app.get("/status/:code") { code.to_i }
5
+ app.post("/status/:code") { code.to_i }
6
+ app.patch("/status/:code") { code.to_i }
7
+ app.put("/status/:code") { code.to_i }
8
+ app.delete("/status/:code") { code.to_i }
9
9
  end
10
10
  end
11
11
  end
@@ -1,17 +1,17 @@
1
1
  module Artifactory
2
2
  module APIServer::SystemEndpoints
3
3
  def self.registered(app)
4
- app.get('/api/system') do
5
- 'This is some serious system info right here'
4
+ app.get("/api/system") do
5
+ "This is some serious system info right here"
6
6
  end
7
7
 
8
- app.get('/api/system/ping') do
9
- 'OK'
8
+ app.get("/api/system/ping") do
9
+ "OK"
10
10
  end
11
11
 
12
- app.get('/api/system/configuration') do
13
- content_type 'application/xml'
14
- <<-EOH.gsub(/^ {10}/, '')
12
+ app.get("/api/system/configuration") do
13
+ content_type "application/xml"
14
+ <<-EOH.gsub(/^ {10}/, "")
15
15
  <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
16
16
  <config xsi:schemaLocation='http://www.jfrog.org/xsd/artifactory-v1_5_3.xsd'
17
17
  xmlns='http://artifactory.jfrog.org/xsd/1.5.3'
@@ -77,27 +77,26 @@ module Artifactory
77
77
  <sendMailOnError>true</sendMailOnError>
78
78
  <excludeBuilds>false</excludeBuilds>
79
79
  </backup>
80
- </backups>
80
+ </backups>
81
81
  </config>
82
82
  EOH
83
83
  end
84
84
 
85
- app.post('/api/system/configuration') do
85
+ app.post("/api/system/configuration") do
86
86
  # Just echo the response we got back, since it seems that's what a real
87
87
  # Artifactory server does...
88
88
  request.body.read
89
89
  end
90
90
 
91
- app.get('/api/system/version') do
92
- content_type 'application/vnd.org.jfrog.artifactory.system.Version+json'
91
+ app.get("/api/system/version") do
92
+ content_type "application/vnd.org.jfrog.artifactory.system.Version+json"
93
93
  JSON.generate({
94
- 'version' => '3.1.0',
95
- 'revision' => '30062',
96
- 'addons' => [
97
- 'ldap',
98
- 'license',
99
- 'yum'
100
- ]
94
+ "version" => "3.1.0",
95
+ "revision" => "30062",
96
+ "addons" => %w{
97
+ ldap
98
+ license
99
+ yum},
101
100
  })
102
101
  end
103
102
  end
@@ -1,57 +1,57 @@
1
1
  module Artifactory
2
2
  module APIServer::UserEndpoints
3
3
  def self.registered(app)
4
- app.get('/api/security/users') do
5
- content_type 'application/vnd.org.jfrog.artifactory.security.Users+json'
4
+ app.get("/api/security/users") do
5
+ content_type "application/vnd.org.jfrog.artifactory.security.Users+json"
6
6
  JSON.fast_generate([
7
7
  {
8
- 'name' => 'sethvargo',
9
- 'uri' => server_url.join('/api/security/users/sethvargo'),
8
+ "name" => "sethvargo",
9
+ "uri" => server_url.join("/api/security/users/sethvargo"),
10
10
  },
11
11
  {
12
- 'name' => 'yzl',
13
- 'uri' => server_url.join('/api/security/users/yzl')
14
- }
12
+ "name" => "yzl",
13
+ "uri" => server_url.join("/api/security/users/yzl"),
14
+ },
15
15
  ])
16
16
  end
17
17
 
18
- app.get('/api/security/users/sethvargo') do
19
- content_type 'application/vnd.org.jfrog.artifactory.security.User+json'
18
+ app.get("/api/security/users/sethvargo") do
19
+ content_type "application/vnd.org.jfrog.artifactory.security.User+json"
20
20
  JSON.fast_generate(
21
- 'admin' => false,
22
- 'email' => 'sethvargo@gmail.com',
23
- 'groups' => ['admin'],
24
- 'internalPasswordDisabled' => true,
25
- 'lastLoggedIn' => nil,
26
- 'name' => 'sethvargo',
27
- 'profileUpdatable' => true,
28
- 'realm' => 'artifactory',
21
+ "admin" => false,
22
+ "email" => "sethvargo@gmail.com",
23
+ "groups" => ["admin"],
24
+ "internalPasswordDisabled" => true,
25
+ "lastLoggedIn" => nil,
26
+ "name" => "sethvargo",
27
+ "profileUpdatable" => true,
28
+ "realm" => "artifactory"
29
29
  )
30
30
  end
31
31
 
32
- app.get('/api/security/users/yzl') do
33
- content_type 'application/vnd.org.jfrog.artifactory.security.User+json'
32
+ app.get("/api/security/users/yzl") do
33
+ content_type "application/vnd.org.jfrog.artifactory.security.User+json"
34
34
  JSON.fast_generate(
35
- 'admin' => true,
36
- 'email' => 'yvonne@getchef.com',
37
- 'groups' => ['admin'],
38
- 'internalPasswordDisabled' => true,
39
- 'lastLoggedIn' => nil,
40
- 'name' => 'yzl',
41
- 'profileUpdatable' => true,
42
- 'realm' => 'crowd',
35
+ "admin" => true,
36
+ "email" => "yvonne@getchef.com",
37
+ "groups" => ["admin"],
38
+ "internalPasswordDisabled" => true,
39
+ "lastLoggedIn" => nil,
40
+ "name" => "yzl",
41
+ "profileUpdatable" => true,
42
+ "realm" => "crowd"
43
43
  )
44
44
  end
45
45
 
46
- app.put('/api/security/users/:name') do
47
- return 415 unless request.content_type == 'application/vnd.org.jfrog.artifactory.security.User+json'
46
+ app.put("/api/security/users/:name") do
47
+ return 415 unless request.content_type == "application/vnd.org.jfrog.artifactory.security.User+json"
48
48
 
49
49
  # Attempt to parse the response; if this succeeds, all is well...
50
50
  JSON.parse(request.body.read)
51
51
  nil
52
52
  end
53
53
 
54
- app.delete('/api/security/users/:name') do
54
+ app.delete("/api/security/users/:name") do
55
55
  nil
56
56
  end
57
57
  end
@@ -1,27 +1,27 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Artifactory do
4
- it 'sets the default values' do
4
+ it "sets the default values" do
5
5
  Artifactory::Configurable.keys.each do |key|
6
6
  value = Artifactory::Defaults.send(key)
7
7
  expect(Artifactory.instance_variable_get(:"@#{key}")).to eq(value)
8
8
  end
9
9
  end
10
10
 
11
- describe '.client' do
12
- it 'creates an Artifactory::Client' do
11
+ describe ".client" do
12
+ it "creates an Artifactory::Client" do
13
13
  expect(Artifactory.client).to be_a(Artifactory::Client)
14
14
  end
15
15
 
16
- it 'caches the client when the same options are passed' do
16
+ it "caches the client when the same options are passed" do
17
17
  expect(Artifactory.client).to eq(Artifactory.client)
18
18
  end
19
19
 
20
- it 'returns a fresh client when options are not the same' do
20
+ it "returns a fresh client when options are not the same" do
21
21
  original_client = Artifactory.client
22
22
 
23
23
  # Change settings
24
- Artifactory.username = 'admin'
24
+ Artifactory.username = "admin"
25
25
  new_client = Artifactory.client
26
26
 
27
27
  # Get it one more tmie
@@ -32,9 +32,9 @@ describe Artifactory do
32
32
  end
33
33
  end
34
34
 
35
- describe '.configure' do
35
+ describe ".configure" do
36
36
  Artifactory::Configurable.keys.each do |key|
37
- it "sets the #{key.to_s.gsub('_', ' ')}" do
37
+ it "sets the #{key.to_s.tr('_', ' ')}" do
38
38
  Artifactory.configure do |config|
39
39
  config.send("#{key}=", key)
40
40
  end
@@ -44,29 +44,29 @@ describe Artifactory do
44
44
  end
45
45
  end
46
46
 
47
- describe '.method_missing' do
48
- context 'when the client responds to the method' do
47
+ describe ".method_missing" do
48
+ context "when the client responds to the method" do
49
49
  let(:client) { double(:client) }
50
50
  before { allow(Artifactory).to receive(:client).and_return(client) }
51
51
 
52
- it 'delegates the method to the client' do
53
- allow(client).to receive(:bacon).and_return('awesome')
52
+ it "delegates the method to the client" do
53
+ allow(client).to receive(:bacon).and_return("awesome")
54
54
  expect { Artifactory.bacon }.to_not raise_error
55
55
  end
56
56
  end
57
57
 
58
- context 'when the client does not respond to the method' do
59
- it 'calls super' do
58
+ context "when the client does not respond to the method" do
59
+ it "calls super" do
60
60
  expect { Artifactory.bacon }.to raise_error(NoMethodError)
61
61
  end
62
62
  end
63
63
  end
64
64
 
65
- describe '.respond_to_missing?' do
65
+ describe ".respond_to_missing?" do
66
66
  let(:client) { double(:client) }
67
67
  before { allow(Artifactory).to receive(:client).and_return(client) }
68
68
 
69
- it 'delegates to the client' do
69
+ it "delegates to the client" do
70
70
  expect { Artifactory.respond_to_missing?(:foo) }.to_not raise_error
71
71
  end
72
72
  end
@@ -1,106 +1,106 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  module Artifactory
4
4
  describe Client do
5
5
  let(:client) { subject }
6
6
 
7
- context 'configuration' do
8
- it 'is a configurable object' do
7
+ context "configuration" do
8
+ it "is a configurable object" do
9
9
  expect(client).to be_a(Configurable)
10
10
  end
11
11
 
12
- it 'users the default configuration' do
12
+ it "users the default configuration" do
13
13
  Defaults.options.each do |key, value|
14
14
  expect(client.send(key)).to eq(value)
15
15
  end
16
16
  end
17
17
 
18
- it 'uses the values in the initializer' do
19
- client = described_class.new(username: 'admin')
20
- expect(client.username).to eq('admin')
18
+ it "uses the values in the initializer" do
19
+ client = described_class.new(username: "admin")
20
+ expect(client.username).to eq("admin")
21
21
  end
22
22
 
23
- it 'can be modified after initialization' do
23
+ it "can be modified after initialization" do
24
24
  expect(client.username).to eq(Defaults.username)
25
- client.username = 'admin'
26
- expect(client.username).to eq('admin')
25
+ client.username = "admin"
26
+ expect(client.username).to eq("admin")
27
27
  end
28
28
  end
29
29
 
30
- describe '.proxy' do
30
+ describe ".proxy" do
31
31
  before { described_class.proxy(Resource::Artifact) }
32
32
 
33
- it 'defines a new method' do
33
+ it "defines a new method" do
34
34
  expect(described_class).to be_method_defined(:artifact_search)
35
35
  end
36
36
 
37
- it 'delegates to the class, injecting the client' do
37
+ it "delegates to the class, injecting the client" do
38
38
  allow(Resource::Artifact).to receive(:search)
39
39
  expect(Resource::Artifact).to receive(:search).with(client: subject)
40
40
  subject.artifact_search
41
41
  end
42
42
  end
43
43
 
44
- describe '#get' do
45
- it 'delegates to the #request method' do
46
- expect(subject).to receive(:request).with(:get, '/foo', {}, {})
47
- subject.get('/foo')
44
+ describe "#get" do
45
+ it "delegates to the #request method" do
46
+ expect(subject).to receive(:request).with(:get, "/foo", {}, {})
47
+ subject.get("/foo")
48
48
  end
49
49
  end
50
50
 
51
- describe '#post' do
51
+ describe "#post" do
52
52
  let(:data) { double }
53
53
 
54
- it 'delegates to the #request method' do
55
- expect(subject).to receive(:request).with(:post, '/foo', data, {})
56
- subject.post('/foo', data)
54
+ it "delegates to the #request method" do
55
+ expect(subject).to receive(:request).with(:post, "/foo", data, {})
56
+ subject.post("/foo", data)
57
57
  end
58
58
  end
59
59
 
60
- describe '#put' do
60
+ describe "#put" do
61
61
  let(:data) { double }
62
62
 
63
- it 'delegates to the #request method' do
64
- expect(subject).to receive(:request).with(:put, '/foo', data, {})
65
- subject.put('/foo', data)
63
+ it "delegates to the #request method" do
64
+ expect(subject).to receive(:request).with(:put, "/foo", data, {})
65
+ subject.put("/foo", data)
66
66
  end
67
67
  end
68
68
 
69
- describe '#patch' do
69
+ describe "#patch" do
70
70
  let(:data) { double }
71
71
 
72
- it 'delegates to the #request method' do
73
- expect(subject).to receive(:request).with(:patch, '/foo', data, {})
74
- subject.patch('/foo', data)
72
+ it "delegates to the #request method" do
73
+ expect(subject).to receive(:request).with(:patch, "/foo", data, {})
74
+ subject.patch("/foo", data)
75
75
  end
76
76
  end
77
77
 
78
- describe '#delete' do
79
- it 'delegates to the #request method' do
80
- expect(subject).to receive(:request).with(:delete, '/foo', {}, {})
81
- subject.delete('/foo')
78
+ describe "#delete" do
79
+ it "delegates to the #request method" do
80
+ expect(subject).to receive(:request).with(:delete, "/foo", {}, {})
81
+ subject.delete("/foo")
82
82
  end
83
83
  end
84
84
 
85
- describe '#request' do
86
- context 'when the response is a 400' do
87
- before { stub_request(:get, /.+/).to_return(status: 5000, body: 'No!') }
85
+ describe "#request" do
86
+ context "when the response is a 400" do
87
+ before { stub_request(:get, /.+/).to_return(status: 5000, body: "No!") }
88
88
 
89
- it 'raises an HTTPError error' do
90
- expect { subject.request(:get, '/') }.to raise_error(Error::HTTPError)
89
+ it "raises an HTTPError error" do
90
+ expect { subject.request(:get, "/") }.to raise_error(Error::HTTPError)
91
91
  end
92
92
  end
93
93
  end
94
94
 
95
- describe '#to_query_string' do
95
+ describe "#to_query_string" do
96
96
  it 'converts spaces to "+" characters' do
97
- params = {user: 'Seth Chisamore'}
98
- expect(subject.to_query_string(params)).to eq('user=Seth+Chisamore')
97
+ params = { user: "Seth Chisamore" }
98
+ expect(subject.to_query_string(params)).to eq("user=Seth+Chisamore")
99
99
  end
100
100
 
101
101
  it 'converts "+" to "%2B"' do
102
- params = {version: '12.0.0-alpha.1+20140826080510.git.50.f5ff271'}
103
- expect(subject.to_query_string(params)).to eq('version=12.0.0-alpha.1%2B20140826080510.git.50.f5ff271')
102
+ params = { version: "12.0.0-alpha.1+20140826080510.git.50.f5ff271" }
103
+ expect(subject.to_query_string(params)).to eq("version=12.0.0-alpha.1%2B20140826080510.git.50.f5ff271")
104
104
  end
105
105
  end
106
106
  end