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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile +9 -13
- data/README.md +10 -1
- data/Rakefile +16 -7
- data/appveyor.yml +4 -2
- data/artifactory.gemspec +14 -14
- data/lib/artifactory.rb +26 -26
- data/lib/artifactory/client.rb +25 -23
- data/lib/artifactory/configurable.rb +1 -0
- data/lib/artifactory/defaults.rb +24 -15
- data/lib/artifactory/errors.rb +2 -2
- data/lib/artifactory/resources/artifact.rb +34 -33
- data/lib/artifactory/resources/backup.rb +5 -5
- data/lib/artifactory/resources/base.rb +7 -7
- data/lib/artifactory/resources/build.rb +15 -15
- data/lib/artifactory/resources/build_component.rb +4 -4
- data/lib/artifactory/resources/group.rb +4 -4
- data/lib/artifactory/resources/layout.rb +3 -3
- data/lib/artifactory/resources/ldap_setting.rb +7 -6
- data/lib/artifactory/resources/mail_server.rb +3 -3
- data/lib/artifactory/resources/permission_target.rb +20 -20
- data/lib/artifactory/resources/plugin.rb +1 -1
- data/lib/artifactory/resources/repository.rb +20 -20
- data/lib/artifactory/resources/system.rb +6 -6
- data/lib/artifactory/resources/url_base.rb +4 -3
- data/lib/artifactory/resources/user.rb +4 -4
- data/lib/artifactory/util.rb +10 -10
- data/lib/artifactory/version.rb +1 -1
- data/spec/integration/resources/artifact_spec.rb +31 -31
- data/spec/integration/resources/backup.rb +7 -7
- data/spec/integration/resources/build_component_spec.rb +18 -18
- data/spec/integration/resources/build_spec.rb +15 -15
- data/spec/integration/resources/group_spec.rb +16 -16
- data/spec/integration/resources/layout_spec.rb +7 -7
- data/spec/integration/resources/ldap_setting_spec.rb +7 -7
- data/spec/integration/resources/mail_server_spec.rb +7 -7
- data/spec/integration/resources/permission_target_spec.rb +35 -35
- data/spec/integration/resources/repository_spec.rb +14 -14
- data/spec/integration/resources/system_spec.rb +20 -21
- data/spec/integration/resources/url_base_spec.rb +7 -7
- data/spec/integration/resources/user_spec.rb +16 -16
- data/spec/spec_helper.rb +11 -11
- data/spec/support/api_server.rb +13 -13
- data/spec/support/api_server/artifact_endpoints.rb +94 -94
- data/spec/support/api_server/build_component_endpoints.rb +18 -18
- data/spec/support/api_server/build_endpoints.rb +76 -76
- data/spec/support/api_server/group_endpoints.rb +24 -24
- data/spec/support/api_server/permission_target_endpoints.rb +24 -24
- data/spec/support/api_server/repository_endpoints.rb +82 -82
- data/spec/support/api_server/status_endpoints.rb +5 -5
- data/spec/support/api_server/system_endpoints.rb +17 -18
- data/spec/support/api_server/user_endpoints.rb +30 -30
- data/spec/unit/artifactory_spec.rb +17 -17
- data/spec/unit/client_spec.rb +43 -43
- data/spec/unit/resources/artifact_spec.rb +256 -256
- data/spec/unit/resources/backup_spec.rb +8 -8
- data/spec/unit/resources/base_spec.rb +51 -51
- data/spec/unit/resources/build_component_spec.rb +45 -45
- data/spec/unit/resources/build_spec.rb +98 -98
- data/spec/unit/resources/defaults_spec.rb +4 -4
- data/spec/unit/resources/group_spec.rb +36 -36
- data/spec/unit/resources/layout_spec.rb +8 -8
- data/spec/unit/resources/ldap_setting_spec.rb +8 -8
- data/spec/unit/resources/mail_server_spec.rb +8 -8
- data/spec/unit/resources/permission_target_spec.rb +79 -79
- data/spec/unit/resources/plugin_spec.rb +7 -7
- data/spec/unit/resources/repository_spec.rb +98 -98
- data/spec/unit/resources/system_spec.rb +30 -30
- data/spec/unit/resources/url_base_spec.rb +8 -8
- data/spec/unit/resources/user_spec.rb +40 -40
- metadata +3 -3
data/lib/artifactory/version.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::Artifact, :integration do
|
|
5
|
-
shared_examples
|
|
5
|
+
shared_examples "an artifact search endpoint" do |name, options = {}|
|
|
6
6
|
it "finds artifacts by #{name}" do
|
|
7
7
|
response = described_class.send(name, options)
|
|
8
8
|
expect(response).to be_a(Array)
|
|
@@ -10,75 +10,75 @@ module Artifactory
|
|
|
10
10
|
|
|
11
11
|
artifact_1 = response[0]
|
|
12
12
|
expect(artifact_1).to be_a(described_class)
|
|
13
|
-
expect(artifact_1.repo).to eq(
|
|
13
|
+
expect(artifact_1.repo).to eq("libs-release-local")
|
|
14
14
|
|
|
15
15
|
artifact_2 = response[1]
|
|
16
16
|
expect(artifact_2).to be_a(described_class)
|
|
17
|
-
expect(artifact_2.repo).to eq(
|
|
17
|
+
expect(artifact_2.repo).to eq("ext-release-local")
|
|
18
18
|
|
|
19
19
|
artifact_3 = response[2]
|
|
20
20
|
expect(artifact_3).to be_a(described_class)
|
|
21
|
-
expect(artifact_3.repo).to eq(
|
|
21
|
+
expect(artifact_3.repo).to eq("bin-release-local")
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it "finds artifacts by repo" do
|
|
25
|
-
response = described_class.send(name, options.merge(repos:
|
|
25
|
+
response = described_class.send(name, options.merge(repos: "libs-release-local"))
|
|
26
26
|
expect(response).to be_a(Array)
|
|
27
27
|
expect(response.size).to eq(1)
|
|
28
28
|
|
|
29
29
|
artifact = response.first
|
|
30
30
|
expect(artifact).to be_a(described_class)
|
|
31
|
-
expect(artifact.repo).to eq(
|
|
31
|
+
expect(artifact.repo).to eq("libs-release-local")
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
describe
|
|
36
|
-
it_behaves_like
|
|
35
|
+
describe ".search" do
|
|
36
|
+
it_behaves_like "an artifact search endpoint", :search, name: "artifact.deb"
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
describe
|
|
40
|
-
it_behaves_like
|
|
41
|
-
group:
|
|
42
|
-
name:
|
|
43
|
-
version:
|
|
44
|
-
classifier:
|
|
39
|
+
describe ".gavc_search" do
|
|
40
|
+
it_behaves_like "an artifact search endpoint", :gavc_search, {
|
|
41
|
+
group: "org.acme",
|
|
42
|
+
name: "artifact.deb",
|
|
43
|
+
version: "1.0",
|
|
44
|
+
classifier: "sources",
|
|
45
45
|
}
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
describe
|
|
49
|
-
it_behaves_like
|
|
50
|
-
branch:
|
|
51
|
-
committer:
|
|
48
|
+
describe ".property_search" do
|
|
49
|
+
it_behaves_like "an artifact search endpoint", :property_search, {
|
|
50
|
+
branch: "master",
|
|
51
|
+
committer: "Seth Vargo",
|
|
52
52
|
}
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
describe
|
|
56
|
-
it_behaves_like
|
|
55
|
+
describe ".checksum_search" do
|
|
56
|
+
it_behaves_like "an artifact search endpoint", :checksum_search, md5: "abcd1234"
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
describe
|
|
60
|
-
it_behaves_like
|
|
59
|
+
describe ".usage_search" do
|
|
60
|
+
it_behaves_like "an artifact search endpoint", :usage_search, notUsedSince: "1414800000"
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
describe
|
|
64
|
-
it_behaves_like
|
|
63
|
+
describe ".creation_search" do
|
|
64
|
+
it_behaves_like "an artifact search endpoint", :creation_search, from: "1414800000"
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
describe
|
|
68
|
-
it
|
|
67
|
+
describe ".versions" do
|
|
68
|
+
it "returns an array of versions" do
|
|
69
69
|
response = described_class.versions
|
|
70
70
|
expect(response).to be_a(Array)
|
|
71
71
|
expect(response.size).to eq(3)
|
|
72
72
|
|
|
73
|
-
expect(response[0][
|
|
73
|
+
expect(response[0]["version"]).to eq("1.2")
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
describe
|
|
78
|
-
it
|
|
77
|
+
describe ".latest_version" do
|
|
78
|
+
it "finds the latest version of the artifact" do
|
|
79
79
|
response = described_class.latest_version
|
|
80
80
|
expect(response).to be_a(String)
|
|
81
|
-
expect(response).to eq(
|
|
81
|
+
expect(response).to eq("1.0-201203131455-2")
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::Backup, :integration do
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
5
|
+
describe ".all" do
|
|
6
|
+
it "returns an array of Backups" do
|
|
7
7
|
results = described_class.all
|
|
8
8
|
expect(results).to be_a(Array)
|
|
9
9
|
expect(results.first).to be_a(described_class)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe
|
|
14
|
-
it
|
|
15
|
-
backup = described_class.find(
|
|
13
|
+
describe ".find" do
|
|
14
|
+
it "finds a Backup by key" do
|
|
15
|
+
backup = described_class.find("backup-daily")
|
|
16
16
|
|
|
17
17
|
expect(backup).to be_a(described_class)
|
|
18
|
-
expect(backup.key).to eq(
|
|
18
|
+
expect(backup.key).to eq("backup-daily")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::BuildComponent, :integration do
|
|
5
|
-
let(:build_component) { described_class.find(
|
|
5
|
+
let(:build_component) { described_class.find("wicket") }
|
|
6
6
|
|
|
7
|
-
describe
|
|
8
|
-
it
|
|
7
|
+
describe ".all" do
|
|
8
|
+
it "returns an array of build component objects" do
|
|
9
9
|
results = described_class.all
|
|
10
10
|
expect(results).to be_a(Array)
|
|
11
11
|
expect(results.first).to be_a(described_class)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
describe
|
|
16
|
-
it
|
|
15
|
+
describe ".find" do
|
|
16
|
+
it "finds a build component by name" do
|
|
17
17
|
expect(build_component).to be_a(described_class)
|
|
18
|
-
expect(build_component.name).to eq(
|
|
19
|
-
expect(build_component.last_started).to eq(Time.parse(
|
|
18
|
+
expect(build_component.name).to eq("wicket")
|
|
19
|
+
expect(build_component.last_started).to eq(Time.parse("2015-06-19T20:13:20.222Z"))
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
describe
|
|
24
|
-
let(:build_numbers) { %w
|
|
23
|
+
describe "#delete" do
|
|
24
|
+
let(:build_numbers) { %w{ 51 52 } }
|
|
25
25
|
let(:delete_all) { false }
|
|
26
26
|
|
|
27
|
-
it
|
|
27
|
+
it "deletes the specified builds from the component" do
|
|
28
28
|
|
|
29
29
|
expect(build_component.delete(
|
|
30
30
|
build_numbers: build_numbers,
|
|
@@ -32,20 +32,20 @@ module Artifactory
|
|
|
32
32
|
)).to be_truthy
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
context
|
|
35
|
+
context "no build numbers provided" do
|
|
36
36
|
let(:build_numbers) { nil }
|
|
37
37
|
|
|
38
|
-
it
|
|
38
|
+
it "deletes no builds" do
|
|
39
39
|
|
|
40
40
|
expect(build_component.delete(
|
|
41
41
|
delete_all: delete_all
|
|
42
42
|
)).to be_falsey
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
context
|
|
45
|
+
context "the delete_all flag is true" do
|
|
46
46
|
let(:delete_all) { true }
|
|
47
47
|
|
|
48
|
-
it
|
|
48
|
+
it "deletes the component and all builds" do
|
|
49
49
|
expect(build_component.delete(
|
|
50
50
|
delete_all: delete_all
|
|
51
51
|
)).to be_truthy
|
|
@@ -54,10 +54,10 @@ module Artifactory
|
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
describe
|
|
58
|
-
it
|
|
57
|
+
describe "#rename" do
|
|
58
|
+
it "renames the build component on the server" do
|
|
59
59
|
|
|
60
|
-
expect(build_component.rename(
|
|
60
|
+
expect(build_component.rename("fricket")).to be_truthy
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::Build, :integration do
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
7
|
-
results = described_class.all(
|
|
5
|
+
describe ".all" do
|
|
6
|
+
it "returns an array of build objects" do
|
|
7
|
+
results = described_class.all("wicket")
|
|
8
8
|
expect(results).to be_a(Array)
|
|
9
9
|
expect(results.first).to be_a(described_class)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe
|
|
14
|
-
it
|
|
15
|
-
build = described_class.find(
|
|
13
|
+
describe ".find" do
|
|
14
|
+
it "finds a build by component and number" do
|
|
15
|
+
build = described_class.find("wicket", 51)
|
|
16
16
|
|
|
17
17
|
expect(build).to be_a(described_class)
|
|
18
|
-
expect(build.name).to eq(
|
|
19
|
-
expect(build.number).to eq(
|
|
20
|
-
expect(build.started).to eq(Time.parse(
|
|
18
|
+
expect(build.name).to eq("wicket")
|
|
19
|
+
expect(build.number).to eq("51")
|
|
20
|
+
expect(build.started).to eq(Time.parse("2014-09-30T12:00:19.893+0300"))
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
describe
|
|
25
|
-
it
|
|
24
|
+
describe "#save" do
|
|
25
|
+
it "saves the build data to the server" do
|
|
26
26
|
build = described_class.new(
|
|
27
|
-
name:
|
|
28
|
-
number:
|
|
27
|
+
name: "fricket",
|
|
28
|
+
number: "1",
|
|
29
29
|
properties: {
|
|
30
|
-
|
|
30
|
+
"buildInfo.env.JAVA_HOME" => "/usr/jdk/latest",
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
expect(build.save).to be_truthy
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::Group, :integration do
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
5
|
+
describe ".all" do
|
|
6
|
+
it "returns an array of group objects" do
|
|
7
7
|
results = described_class.all
|
|
8
8
|
expect(results).to be_a(Array)
|
|
9
9
|
expect(results.first).to be_a(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
it
|
|
12
|
+
it "includes the information from the server" do
|
|
13
13
|
results = described_class.all
|
|
14
14
|
readers = results[0]
|
|
15
15
|
leads = results[1]
|
|
16
16
|
|
|
17
|
-
expect(readers.name).to eq(
|
|
18
|
-
expect(leads.name).to eq(
|
|
17
|
+
expect(readers.name).to eq("readers")
|
|
18
|
+
expect(leads.name).to eq("tech-leads")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
describe
|
|
23
|
-
it
|
|
24
|
-
readers = described_class.find(
|
|
22
|
+
describe ".find" do
|
|
23
|
+
it "finds a group by name" do
|
|
24
|
+
readers = described_class.find("readers")
|
|
25
25
|
|
|
26
26
|
expect(readers).to be_a(described_class)
|
|
27
|
-
expect(readers.name).to eq(
|
|
27
|
+
expect(readers.name).to eq("readers")
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
describe
|
|
32
|
-
it
|
|
33
|
-
readers = described_class.find(
|
|
31
|
+
describe "#delete" do
|
|
32
|
+
it "deletes the group from the server" do
|
|
33
|
+
readers = described_class.find("readers")
|
|
34
34
|
expect(readers.delete).to be_truthy
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
describe
|
|
39
|
-
it
|
|
40
|
-
group = described_class.new(name:
|
|
38
|
+
describe "#save" do
|
|
39
|
+
it "saves the group to the server" do
|
|
40
|
+
group = described_class.new(name: "testing")
|
|
41
41
|
expect(group.save).to be_truthy
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::Layout, :integration do
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
5
|
+
describe ".all" do
|
|
6
|
+
it "returns an array of Layouts" do
|
|
7
7
|
results = described_class.all
|
|
8
8
|
expect(results).to be_a(Array)
|
|
9
9
|
expect(results.first).to be_a(described_class)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe
|
|
14
|
-
it
|
|
15
|
-
mvn_layout = described_class.find(
|
|
13
|
+
describe ".find" do
|
|
14
|
+
it "finds a layout by name" do
|
|
15
|
+
mvn_layout = described_class.find("maven-2-default")
|
|
16
16
|
|
|
17
17
|
expect(mvn_layout).to be_a(described_class)
|
|
18
|
-
expect(mvn_layout.name).to eq(
|
|
18
|
+
expect(mvn_layout.name).to eq("maven-2-default")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::LDAPSetting, :integration do
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
5
|
+
describe ".all" do
|
|
6
|
+
it "returns an array of LdapSetting" do
|
|
7
7
|
results = described_class.all
|
|
8
8
|
expect(results).to be_a(Array)
|
|
9
9
|
expect(results.first).to be_a(described_class)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe
|
|
14
|
-
it
|
|
15
|
-
ldap = described_class.find(
|
|
13
|
+
describe ".find" do
|
|
14
|
+
it "finds an LdapSetting by key" do
|
|
15
|
+
ldap = described_class.find("example-ldap")
|
|
16
16
|
|
|
17
17
|
expect(ldap).to be_a(described_class)
|
|
18
|
-
expect(ldap.key).to eq(
|
|
18
|
+
expect(ldap.key).to eq("example-ldap")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::MailServer, :integration do
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
5
|
+
describe ".all" do
|
|
6
|
+
it "returns an array of MailServer" do
|
|
7
7
|
results = described_class.all
|
|
8
8
|
expect(results).to be_a(Array)
|
|
9
9
|
expect(results.first).to be_a(described_class)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe
|
|
14
|
-
it
|
|
15
|
-
smtp = described_class.find(
|
|
13
|
+
describe ".find" do
|
|
14
|
+
it "finds a MailServer by host" do
|
|
15
|
+
smtp = described_class.find("smtp.gmail.com")
|
|
16
16
|
|
|
17
17
|
expect(smtp).to be_a(described_class)
|
|
18
|
-
expect(smtp.host).to eq(
|
|
18
|
+
expect(smtp.host).to eq("smtp.gmail.com")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
module Artifactory
|
|
4
4
|
describe Resource::PermissionTarget, :integration do
|
|
5
|
-
describe
|
|
6
|
-
it
|
|
5
|
+
describe ".all" do
|
|
6
|
+
it "returns an array of PermissionTarget objects" do
|
|
7
7
|
results = described_class.all
|
|
8
8
|
expect(results).to be_a(Array)
|
|
9
9
|
expect(results.first).to be_a(described_class)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
it
|
|
12
|
+
it "includes the information from the server" do
|
|
13
13
|
results = described_class.all
|
|
14
14
|
anything = results[0]
|
|
15
|
-
any_remote
|
|
15
|
+
any_remote = results[1]
|
|
16
16
|
|
|
17
|
-
expect(anything.name).to eq(
|
|
18
|
-
expect(any_remote.name).to eq(
|
|
17
|
+
expect(anything.name).to eq("Anything")
|
|
18
|
+
expect(any_remote.name).to eq("Any Remote")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
describe
|
|
23
|
-
it
|
|
24
|
-
readers = described_class.find(
|
|
22
|
+
describe ".find" do
|
|
23
|
+
it "finds a permission target by name" do
|
|
24
|
+
readers = described_class.find("Anything")
|
|
25
25
|
|
|
26
26
|
expect(readers).to be_a(described_class)
|
|
27
|
-
expect(readers.name).to eq(
|
|
27
|
+
expect(readers.name).to eq("Anything")
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
describe
|
|
32
|
-
it
|
|
33
|
-
readers = described_class.find(
|
|
31
|
+
describe "#delete" do
|
|
32
|
+
it "deletes the permission target from the server" do
|
|
33
|
+
readers = described_class.find("Anything")
|
|
34
34
|
expect(readers.delete).to be_truthy
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
describe
|
|
39
|
-
it
|
|
40
|
-
target = described_class.new(name:
|
|
38
|
+
describe "#save" do
|
|
39
|
+
it "saves the permission target to the server" do
|
|
40
|
+
target = described_class.new(name: "testing")
|
|
41
41
|
expect(target.save).to be_truthy
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
describe
|
|
46
|
-
it
|
|
47
|
-
target = described_class.find(
|
|
48
|
-
expect(target.users).to eq( {
|
|
45
|
+
describe "#users" do
|
|
46
|
+
it "displays the users hash with sorted verbose permissions" do
|
|
47
|
+
target = described_class.find("Any Remote")
|
|
48
|
+
expect(target.users).to eq( { "anonymous" => %w{deploy read} } )
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
describe
|
|
53
|
-
it
|
|
54
|
-
target = described_class.find(
|
|
55
|
-
expect(target.groups).to eq( {
|
|
52
|
+
describe "#groups" do
|
|
53
|
+
it "displays the groups hash with sorted verbose permissions" do
|
|
54
|
+
target = described_class.find("Anything")
|
|
55
|
+
expect(target.groups).to eq( { "readers" => %w{admin read} } )
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
describe
|
|
60
|
-
it
|
|
61
|
-
target = described_class.find(
|
|
62
|
-
target.users = {
|
|
63
|
-
expect(target.users).to eq( {
|
|
59
|
+
describe "#users=" do
|
|
60
|
+
it "sets the users hash" do
|
|
61
|
+
target = described_class.find("Any Remote")
|
|
62
|
+
target.users = { "admins" => ["admin"] }
|
|
63
|
+
expect(target.users).to eq( { "admins" => ["admin"] })
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
describe
|
|
68
|
-
it
|
|
69
|
-
target = described_class.find(
|
|
70
|
-
target.groups = {
|
|
71
|
-
expect(target.groups).to eq( {
|
|
67
|
+
describe "#groups=" do
|
|
68
|
+
it "sets the groups hash" do
|
|
69
|
+
target = described_class.find("Anything")
|
|
70
|
+
target.groups = { "deployers" => ["deploy"] }
|
|
71
|
+
expect(target.groups).to eq( { "deployers" => ["deploy"] })
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|