ridley 4.0.0 → 4.3.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/CHANGELOG.md +31 -0
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/Rakefile +1 -0
- data/lib/ridley/chef/config.rb +5 -5
- data/lib/ridley/chef/cookbook/metadata.rb +59 -14
- data/lib/ridley/chef/cookbook/syntax_check.rb +57 -19
- data/lib/ridley/chef/cookbook.rb +1 -1
- data/lib/ridley/chef/digester.rb +3 -1
- data/lib/ridley/client.rb +6 -3
- data/lib/ridley/connection.rb +5 -4
- data/lib/ridley/errors.rb +1 -0
- data/lib/ridley/helpers.rb +10 -0
- data/lib/ridley/mixin/params_validate.rb +4 -0
- data/lib/ridley/resources/cookbook_resource.rb +14 -2
- data/lib/ridley/version.rb +1 -1
- data/ridley.gemspec +5 -5
- data/spec/acceptance/client_resource_spec.rb +12 -12
- data/spec/acceptance/cookbook_resource_spec.rb +15 -15
- data/spec/acceptance/data_bag_item_resource_spec.rb +14 -14
- data/spec/acceptance/data_bag_resource_spec.rb +4 -4
- data/spec/acceptance/environment_resource_spec.rb +14 -14
- data/spec/acceptance/node_resource_spec.rb +15 -15
- data/spec/acceptance/role_resource_spec.rb +14 -14
- data/spec/acceptance/sandbox_resource_spec.rb +3 -3
- data/spec/acceptance/search_resource_spec.rb +6 -6
- data/spec/acceptance/user_resource_spec.rb +21 -21
- data/spec/support/each_matcher.rb +2 -2
- data/spec/support/filepath_matchers.rb +2 -2
- data/spec/support/shared_examples/ridley_resource.rb +39 -39
- data/spec/unit/ridley/chef/cookbook/metadata_spec.rb +8 -8
- data/spec/unit/ridley/chef/cookbook/syntax_check_spec.rb +15 -15
- data/spec/unit/ridley/chef/cookbook_spec.rb +159 -114
- data/spec/unit/ridley/chef/digester_spec.rb +2 -2
- data/spec/unit/ridley/chef_object_spec.rb +35 -35
- data/spec/unit/ridley/chef_objects/client_object_spec.rb +2 -2
- data/spec/unit/ridley/chef_objects/cookbook_object_spec.rb +12 -12
- data/spec/unit/ridley/chef_objects/data_bag_item_object_spec.rb +7 -7
- data/spec/unit/ridley/chef_objects/data_bag_object_spec.rb +4 -1
- data/spec/unit/ridley/chef_objects/environment_object_spec.rb +10 -10
- data/spec/unit/ridley/chef_objects/node_object_spec.rb +28 -28
- data/spec/unit/ridley/chef_objects/role_object_spec.rb +10 -10
- data/spec/unit/ridley/chef_objects/sandbox_object_spec.rb +6 -6
- data/spec/unit/ridley/client_spec.rb +59 -21
- data/spec/unit/ridley/connection_spec.rb +7 -7
- data/spec/unit/ridley/errors_spec.rb +3 -3
- data/spec/unit/ridley/middleware/chef_auth_spec.rb +2 -2
- data/spec/unit/ridley/middleware/chef_response_spec.rb +29 -29
- data/spec/unit/ridley/middleware/parse_json_spec.rb +14 -14
- data/spec/unit/ridley/mixins/from_file_spec.rb +3 -3
- data/spec/unit/ridley/resource_spec.rb +5 -5
- data/spec/unit/ridley/resources/cookbook_resource_spec.rb +21 -21
- data/spec/unit/ridley/resources/data_bag_item_resource_spec.rb +1 -1
- data/spec/unit/ridley/resources/data_bag_resource_spec.rb +6 -3
- data/spec/unit/ridley/resources/environment_resource_spec.rb +4 -4
- data/spec/unit/ridley/resources/role_resource_spec.rb +1 -1
- data/spec/unit/ridley/resources/sandbox_resource_spec.rb +7 -7
- data/spec/unit/ridley/resources/search_resource_spec.rb +22 -22
- data/spec/unit/ridley/sandbox_uploader_spec.rb +3 -3
- data/spec/unit/ridley_spec.rb +6 -6
- metadata +62 -64
- data/.ruby-version +0 -1
- data/lib/ridley/middleware/gzip.rb +0 -18
- data/spec/unit/ridley/middleware/gzip_spec.rb +0 -59
|
@@ -18,7 +18,7 @@ describe "Client API operations", type: "acceptance" do
|
|
|
18
18
|
before { subject.download(name, version, destination) }
|
|
19
19
|
|
|
20
20
|
it "downloads the cookbook to the destination" do
|
|
21
|
-
expect(File.exist?(destination.join("metadata.json"))).to
|
|
21
|
+
expect(File.exist?(destination.join("metadata.json"))).to be_truthy
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -30,23 +30,23 @@ describe "Client API operations", type: "acceptance" do
|
|
|
30
30
|
subject.upload(path)
|
|
31
31
|
cookbook = subject.find("example_cookbook", "0.1.0")
|
|
32
32
|
|
|
33
|
-
cookbook.attributes.
|
|
34
|
-
cookbook.definitions.
|
|
35
|
-
cookbook.files.
|
|
36
|
-
cookbook.libraries.
|
|
37
|
-
cookbook.providers.
|
|
38
|
-
cookbook.recipes.
|
|
39
|
-
cookbook.resources.
|
|
40
|
-
cookbook.templates.
|
|
41
|
-
cookbook.root_files.
|
|
33
|
+
expect(cookbook.attributes.size).to eq(1)
|
|
34
|
+
expect(cookbook.definitions.size).to eq(1)
|
|
35
|
+
expect(cookbook.files.size).to eq(2)
|
|
36
|
+
expect(cookbook.libraries.size).to eq(1)
|
|
37
|
+
expect(cookbook.providers.size).to eq(1)
|
|
38
|
+
expect(cookbook.recipes.size).to eq(1)
|
|
39
|
+
expect(cookbook.resources.size).to eq(1)
|
|
40
|
+
expect(cookbook.templates.size).to eq(1)
|
|
41
|
+
expect(cookbook.root_files.size).to eq(1)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
it "does not contain a raw metadata.rb but does contain a compiled metadata.json" do
|
|
45
45
|
subject.upload(path)
|
|
46
46
|
cookbook = subject.find("example_cookbook", "0.1.0")
|
|
47
47
|
|
|
48
|
-
expect(cookbook.root_files.any? { |f| f[:name] == "metadata.json" }).to
|
|
49
|
-
expect(cookbook.root_files.any? { |f| f[:name] == "metadata.rb" }).to
|
|
48
|
+
expect(cookbook.root_files.any? { |f| f[:name] == "metadata.json" }).to be_truthy
|
|
49
|
+
expect(cookbook.root_files.any? { |f| f[:name] == "metadata.rb" }).to be_falsey
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -60,9 +60,9 @@ describe "Client API operations", type: "acceptance" do
|
|
|
60
60
|
|
|
61
61
|
it "returns all of the cookbooks on the server" do
|
|
62
62
|
all_cookbooks = subject.all
|
|
63
|
-
expect(all_cookbooks).to
|
|
64
|
-
expect(all_cookbooks["ruby"]).to
|
|
65
|
-
expect(all_cookbooks["elixir"]).to
|
|
63
|
+
expect(all_cookbooks.size).to eq(2)
|
|
64
|
+
expect(all_cookbooks["ruby"].size).to eq(2)
|
|
65
|
+
expect(all_cookbooks["elixir"].size).to eq(2)
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
end
|
|
@@ -14,7 +14,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
14
14
|
describe "listing data bag items" do
|
|
15
15
|
context "when the data bag has no items" do
|
|
16
16
|
it "returns an empty array" do
|
|
17
|
-
data_bag.item.all.
|
|
17
|
+
expect(data_bag.item.all.size).to eq(0)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it "returns an array with each item" do
|
|
28
|
-
data_bag.item.all.
|
|
28
|
+
expect(data_bag.item.all.size).to eq(2)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -34,7 +34,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
34
34
|
it "adds a data bag item to the collection of data bag items" do
|
|
35
35
|
data_bag.item.create(id: "appconfig", host: "host.local", port: 80, admin: false, servers: ["one"])
|
|
36
36
|
|
|
37
|
-
data_bag.item.all.
|
|
37
|
+
expect(data_bag.item.all.size).to eq(1)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
context "when an 'id' field is missing" do
|
|
@@ -59,7 +59,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
59
59
|
}
|
|
60
60
|
data_bag.item.create(attributes)
|
|
61
61
|
|
|
62
|
-
data_bag.item.find("appconfig").to_hash.
|
|
62
|
+
expect(data_bag.item.find("appconfig").to_hash).to eql(attributes)
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -76,14 +76,14 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
76
76
|
it "returns the deleted data bag item" do
|
|
77
77
|
dbi = data_bag.item.delete(attributes["id"])
|
|
78
78
|
|
|
79
|
-
dbi.
|
|
80
|
-
dbi.attributes.
|
|
79
|
+
expect(dbi).to be_a(Ridley::DataBagItemObject)
|
|
80
|
+
expect(dbi.attributes).to eql(attributes)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "deletes the data bag item from the server" do
|
|
84
84
|
data_bag.item.delete(attributes["id"])
|
|
85
85
|
|
|
86
|
-
data_bag.item.find(attributes["id"]).
|
|
86
|
+
expect(data_bag.item.find(attributes["id"])).to be_nil
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
|
|
@@ -94,13 +94,13 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
it "returns the array of deleted data bag items" do
|
|
97
|
-
data_bag.item.delete_all.
|
|
97
|
+
expect(data_bag.item.delete_all).to each be_a(Ridley::DataBagItemObject)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
it "removes all data bag items from the data bag" do
|
|
101
101
|
data_bag.item.delete_all
|
|
102
102
|
|
|
103
|
-
data_bag.item.all.
|
|
103
|
+
expect(data_bag.item.all.size).to eq(0)
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -110,7 +110,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
110
110
|
it "returns the updated data bag item" do
|
|
111
111
|
dbi = data_bag.item.update(id: "one", name: "brooke")
|
|
112
112
|
|
|
113
|
-
dbi[:name].
|
|
113
|
+
expect(dbi[:name]).to eql("brooke")
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
|
|
@@ -120,14 +120,14 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
120
120
|
|
|
121
121
|
it "returns true if successful" do
|
|
122
122
|
dbi[:name] = "brooke"
|
|
123
|
-
dbi.save.
|
|
123
|
+
expect(dbi.save).to be_truthy
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
it "creates a new data bag item on the remote" do
|
|
127
127
|
dbi[:name] = "brooke"
|
|
128
128
|
dbi.save
|
|
129
129
|
|
|
130
|
-
data_bag.item.all.
|
|
130
|
+
expect(data_bag.item.all.size).to eq(1)
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
133
|
|
|
@@ -136,7 +136,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
136
136
|
dbi = data_bag.item.new
|
|
137
137
|
|
|
138
138
|
dbi.attributes = { id: "not-there", name: "brooke" }
|
|
139
|
-
dbi.save.
|
|
139
|
+
expect(dbi.save).to be_truthy
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
it "creates a new data bag item on the remote" do
|
|
@@ -144,7 +144,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
144
144
|
dbi.attributes = { id: "not-there", name: "brooke" }
|
|
145
145
|
dbi.save
|
|
146
146
|
|
|
147
|
-
data_bag.item.all.
|
|
147
|
+
expect(data_bag.item.all.size).to eq(1)
|
|
148
148
|
end
|
|
149
149
|
end
|
|
150
150
|
end
|
|
@@ -9,7 +9,7 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
9
9
|
describe "listing data bags" do
|
|
10
10
|
context "when no data bags exist" do
|
|
11
11
|
it "returns an empty array" do
|
|
12
|
-
connection.data_bag.all.
|
|
12
|
+
expect(connection.data_bag.all.size).to eq(0)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -20,18 +20,18 @@ describe "DataBag API operations", type: "acceptance" do
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it "returns an array of data bags" do
|
|
23
|
-
connection.data_bag.all.
|
|
23
|
+
expect(connection.data_bag.all).to each be_a(Ridley::DataBagObject)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it "returns all of the data bags on the server" do
|
|
27
|
-
connection.data_bag.all.
|
|
27
|
+
expect(connection.data_bag.all.size).to eq(2)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
describe "creating a data bag" do
|
|
33
33
|
it "returns a Ridley::DataBagObject" do
|
|
34
|
-
connection.data_bag.create(name: "ridley-one").
|
|
34
|
+
expect(connection.data_bag.create(name: "ridley-one")).to be_a(Ridley::DataBagObject)
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -10,7 +10,7 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
10
10
|
before { chef_environment("ridley-test-env") }
|
|
11
11
|
|
|
12
12
|
it "returns a valid Ridley::EnvironmentObject object" do
|
|
13
|
-
connection.environment.find("ridley-test-env").
|
|
13
|
+
expect(connection.environment.find("ridley-test-env")).to be_a(Ridley::EnvironmentObject)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -18,13 +18,13 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
18
18
|
it "returns a valid Ridley::EnvironmentObject object" do
|
|
19
19
|
obj = connection.environment.create(name: "ridley-test-env", description: "a testing env for ridley")
|
|
20
20
|
|
|
21
|
-
obj.
|
|
21
|
+
expect(obj).to be_a(Ridley::EnvironmentObject)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it "adds an environment to the chef server" do
|
|
25
25
|
old = connection.environment.all.length
|
|
26
26
|
connection.environment.create(name: "ridley")
|
|
27
|
-
connection.environment.all.
|
|
27
|
+
expect(connection.environment.all.size).to eq(old + 1)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -32,19 +32,19 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
32
32
|
before { chef_environment("ridley-env") }
|
|
33
33
|
|
|
34
34
|
it "returns a Ridley::EnvironmentObject object" do
|
|
35
|
-
connection.environment.delete("ridley-env").
|
|
35
|
+
expect(connection.environment.delete("ridley-env")).to be_a(Ridley::EnvironmentObject)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it "removes the environment from the server" do
|
|
39
39
|
connection.environment.delete("ridley-env")
|
|
40
40
|
|
|
41
|
-
connection.environment.find("ridley-env").
|
|
41
|
+
expect(connection.environment.find("ridley-env")).to be_nil
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
it "raises Ridley::Errors::HTTPMethodNotAllowed when attempting to delete the '_default' environment" do
|
|
45
|
-
|
|
45
|
+
expect {
|
|
46
46
|
connection.environment.delete("_default")
|
|
47
|
-
}.
|
|
47
|
+
}.to raise_error(Ridley::Errors::HTTPMethodNotAllowed)
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -55,19 +55,19 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it "returns an array of Ridley::EnvironmentObject objects" do
|
|
58
|
-
connection.environment.delete_all.
|
|
58
|
+
expect(connection.environment.delete_all).to each be_a(Ridley::EnvironmentObject)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
it "deletes all environments but '_default' from the remote" do
|
|
62
62
|
connection.environment.delete_all
|
|
63
63
|
|
|
64
|
-
connection.environment.all.
|
|
64
|
+
expect(connection.environment.all.size).to eq(1)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
describe "listing all environments" do
|
|
69
69
|
it "should return an array of Ridley::EnvironmentObject objects" do
|
|
70
|
-
connection.environment.all.
|
|
70
|
+
expect(connection.environment.all).to each be_a(Ridley::EnvironmentObject)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -79,7 +79,7 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
79
79
|
target.description = description = "ridley testing environment"
|
|
80
80
|
|
|
81
81
|
connection.environment.update(target)
|
|
82
|
-
target.reload.description.
|
|
82
|
+
expect(target.reload.description).to eql(description)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
it "saves a new set of 'default_attributes'" do
|
|
@@ -92,7 +92,7 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
92
92
|
|
|
93
93
|
connection.environment.update(target)
|
|
94
94
|
obj = connection.environment.find(target)
|
|
95
|
-
obj.default_attributes.
|
|
95
|
+
expect(obj.default_attributes).to eql(default_attributes)
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
it "saves a new set of 'override_attributes'" do
|
|
@@ -105,7 +105,7 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
105
105
|
|
|
106
106
|
connection.environment.update(target)
|
|
107
107
|
obj = connection.environment.find(target)
|
|
108
|
-
obj.override_attributes.
|
|
108
|
+
expect(obj.override_attributes).to eql(override_attributes)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
it "saves a new set of 'cookbook_versions'" do
|
|
@@ -116,7 +116,7 @@ describe "Environment API operations", type: "acceptance" do
|
|
|
116
116
|
|
|
117
117
|
connection.environment.update(target)
|
|
118
118
|
obj = connection.environment.find(target)
|
|
119
|
-
obj.cookbook_versions.
|
|
119
|
+
expect(obj.cookbook_versions).to eql(cookbook_versions)
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
122
|
end
|
|
@@ -11,7 +11,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
11
11
|
before { chef_node(node_name) }
|
|
12
12
|
|
|
13
13
|
it "returns a Ridley::NodeObject" do
|
|
14
|
-
connection.node.find(node_name).
|
|
14
|
+
expect(connection.node.find(node_name)).to be_a(Ridley::NodeObject)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -19,13 +19,13 @@ describe "Node API operations", type: "acceptance" do
|
|
|
19
19
|
let(:node_name) { "ridley.localhost" }
|
|
20
20
|
|
|
21
21
|
it "returns a new Ridley::NodeObject object" do
|
|
22
|
-
connection.node.create(name: node_name).
|
|
22
|
+
expect(connection.node.create(name: node_name)).to be_a(Ridley::NodeObject)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "adds a new node to the server" do
|
|
26
26
|
connection.node.create(name: node_name)
|
|
27
27
|
|
|
28
|
-
connection.node.all.
|
|
28
|
+
expect(connection.node.all.size).to eq(1)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -34,13 +34,13 @@ describe "Node API operations", type: "acceptance" do
|
|
|
34
34
|
before { chef_node(node_name) }
|
|
35
35
|
|
|
36
36
|
it "returns a Ridley::NodeObject" do
|
|
37
|
-
connection.node.delete(node_name).
|
|
37
|
+
expect(connection.node.delete(node_name)).to be_a(Ridley::NodeObject)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it "removes the node from the server" do
|
|
41
41
|
connection.node.delete(node_name)
|
|
42
42
|
|
|
43
|
-
connection.node.find(node_name).
|
|
43
|
+
expect(connection.node.find(node_name)).to be_nil
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -53,7 +53,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
53
53
|
it "deletes all nodes from the remote server" do
|
|
54
54
|
connection.node.delete_all
|
|
55
55
|
|
|
56
|
-
connection.node.all.
|
|
56
|
+
expect(connection.node.all.size).to eq(0)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -66,8 +66,8 @@ describe "Node API operations", type: "acceptance" do
|
|
|
66
66
|
it "returns an array of Ridley::NodeObject" do
|
|
67
67
|
obj = connection.node.all
|
|
68
68
|
|
|
69
|
-
obj.
|
|
70
|
-
obj.
|
|
69
|
+
expect(obj).to each be_a(Ridley::NodeObject)
|
|
70
|
+
expect(obj.size).to eq(2)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -77,7 +77,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
77
77
|
let(:target) { connection.node.find(node_name) }
|
|
78
78
|
|
|
79
79
|
it "returns the updated node" do
|
|
80
|
-
connection.node.update(target).
|
|
80
|
+
expect(connection.node.update(target)).to eql(target)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "saves a new set of 'normal' attributes" do
|
|
@@ -91,7 +91,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
91
91
|
connection.node.update(target)
|
|
92
92
|
obj = connection.node.find(target)
|
|
93
93
|
|
|
94
|
-
obj.normal.
|
|
94
|
+
expect(obj.normal).to eql(normal)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
it "saves a new set of 'default' attributes" do
|
|
@@ -105,7 +105,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
105
105
|
connection.node.update(target)
|
|
106
106
|
obj = connection.node.find(target)
|
|
107
107
|
|
|
108
|
-
obj.default.
|
|
108
|
+
expect(obj.default).to eql(defaults)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
it "saves a new set of 'automatic' attributes" do
|
|
@@ -119,7 +119,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
119
119
|
connection.node.update(target)
|
|
120
120
|
obj = connection.node.find(target)
|
|
121
121
|
|
|
122
|
-
obj.automatic.
|
|
122
|
+
expect(obj.automatic).to eql(automatics)
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
it "saves a new set of 'override' attributes" do
|
|
@@ -133,7 +133,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
133
133
|
connection.node.update(target)
|
|
134
134
|
obj = connection.node.find(target)
|
|
135
135
|
|
|
136
|
-
obj.override.
|
|
136
|
+
expect(obj.override).to eql(overrides)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
it "places a node in a new 'chef_environment'" do
|
|
@@ -142,7 +142,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
142
142
|
connection.node.update(target)
|
|
143
143
|
obj = connection.node.find(target)
|
|
144
144
|
|
|
145
|
-
obj.chef_environment.
|
|
145
|
+
expect(obj.chef_environment).to eql(environment)
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
it "saves a new 'run_list' for the node" do
|
|
@@ -151,7 +151,7 @@ describe "Node API operations", type: "acceptance" do
|
|
|
151
151
|
connection.node.update(target)
|
|
152
152
|
obj = connection.node.find(target)
|
|
153
153
|
|
|
154
|
-
obj.run_list.
|
|
154
|
+
expect(obj.run_list).to eql(run_list)
|
|
155
155
|
end
|
|
156
156
|
end
|
|
157
157
|
end
|
|
@@ -11,7 +11,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
11
11
|
before { chef_role(role_name) }
|
|
12
12
|
|
|
13
13
|
it "returns a Ridley::RoleObject" do
|
|
14
|
-
connection.role.find(role_name).
|
|
14
|
+
expect(connection.role.find(role_name)).to be_a(Ridley::RoleObject)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -19,12 +19,12 @@ describe "Role API operations", type: "acceptance" do
|
|
|
19
19
|
let(:role_name) { "ridley-role" }
|
|
20
20
|
|
|
21
21
|
it "returns a new Ridley::RoleObject" do
|
|
22
|
-
connection.role.create(name: role_name).
|
|
22
|
+
expect(connection.role.create(name: role_name)).to be_a(Ridley::RoleObject)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "adds a new role to the server" do
|
|
26
26
|
connection.role.create(name: role_name)
|
|
27
|
-
connection.role.all.
|
|
27
|
+
expect(connection.role.all.size).to eq(1)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -33,13 +33,13 @@ describe "Role API operations", type: "acceptance" do
|
|
|
33
33
|
before { chef_role(role_name) }
|
|
34
34
|
|
|
35
35
|
it "returns the deleted Ridley::RoleObject resource" do
|
|
36
|
-
connection.role.delete(role_name).
|
|
36
|
+
expect(connection.role.delete(role_name)).to be_a(Ridley::RoleObject)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it "removes the role from the server" do
|
|
40
40
|
connection.role.delete(role_name)
|
|
41
41
|
|
|
42
|
-
connection.role.find(role_name).
|
|
42
|
+
expect(connection.role.find(role_name)).to be_nil
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -52,7 +52,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
52
52
|
it "deletes all nodes from the remote server" do
|
|
53
53
|
connection.role.delete_all
|
|
54
54
|
|
|
55
|
-
connection.role.all.
|
|
55
|
+
expect(connection.role.all.size).to eq(0)
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -65,8 +65,8 @@ describe "Role API operations", type: "acceptance" do
|
|
|
65
65
|
it "should return an array of Ridley::RoleObject" do
|
|
66
66
|
obj = connection.role.all
|
|
67
67
|
|
|
68
|
-
obj.
|
|
69
|
-
obj.
|
|
68
|
+
expect(obj.size).to eq(2)
|
|
69
|
+
expect(obj).to each be_a(Ridley::RoleObject)
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -76,7 +76,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
76
76
|
let(:target) { connection.role.find(role_name) }
|
|
77
77
|
|
|
78
78
|
it "returns an updated Ridley::RoleObject object" do
|
|
79
|
-
connection.role.update(target).
|
|
79
|
+
expect(connection.role.update(target)).to eql(target)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
it "saves a new run_list" do
|
|
@@ -85,7 +85,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
85
85
|
connection.role.update(target)
|
|
86
86
|
obj = connection.role.find(target)
|
|
87
87
|
|
|
88
|
-
obj.run_list.
|
|
88
|
+
expect(obj.run_list).to eql(run_list)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
it "saves a new env_run_lists" do
|
|
@@ -97,7 +97,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
97
97
|
connection.role.update(target)
|
|
98
98
|
obj = connection.role.find(target)
|
|
99
99
|
|
|
100
|
-
obj.env_run_lists.
|
|
100
|
+
expect(obj.env_run_lists).to eql(env_run_lists)
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
it "saves a new description" do
|
|
@@ -106,7 +106,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
106
106
|
connection.role.update(target)
|
|
107
107
|
obj = connection.role.find(target)
|
|
108
108
|
|
|
109
|
-
obj.description.
|
|
109
|
+
expect(obj.description).to eql(description)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
it "saves a new default_attributes" do
|
|
@@ -120,7 +120,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
120
120
|
connection.role.update(target)
|
|
121
121
|
obj = connection.role.find(target)
|
|
122
122
|
|
|
123
|
-
obj.default_attributes.
|
|
123
|
+
expect(obj.default_attributes).to eql(defaults)
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
it "saves a new override_attributes" do
|
|
@@ -134,7 +134,7 @@ describe "Role API operations", type: "acceptance" do
|
|
|
134
134
|
connection.role.update(target)
|
|
135
135
|
obj = connection.role.find(target)
|
|
136
136
|
|
|
137
|
-
obj.override_attributes.
|
|
137
|
+
expect(obj.override_attributes).to eql(overrides)
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
140
|
end
|
|
@@ -15,15 +15,15 @@ describe "Sandbox API operations", type: "acceptance" do
|
|
|
15
15
|
|
|
16
16
|
describe "creating a new sandbox" do
|
|
17
17
|
it "returns an instance of Ridley::SandboxObject" do
|
|
18
|
-
connection.sandbox.create(checksums).
|
|
18
|
+
expect(connection.sandbox.create(checksums)).to be_a(Ridley::SandboxObject)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "contains a value for sandbox_id" do
|
|
22
|
-
connection.sandbox.create(checksums).sandbox_id.
|
|
22
|
+
expect(connection.sandbox.create(checksums).sandbox_id).not_to be_nil
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "returns an instance with the same amount of checksums given to create" do
|
|
26
|
-
connection.sandbox.create(checksums).checksums.
|
|
26
|
+
expect(connection.sandbox.create(checksums).checksums.size).to eq(2)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -10,18 +10,18 @@ describe "Search API operations", type: "acceptance" do
|
|
|
10
10
|
it "returns an array of indexes" do
|
|
11
11
|
indexes = connection.search_indexes
|
|
12
12
|
|
|
13
|
-
indexes.
|
|
14
|
-
indexes.
|
|
15
|
-
indexes.
|
|
16
|
-
indexes.
|
|
13
|
+
expect(indexes).to include("role")
|
|
14
|
+
expect(indexes).to include("node")
|
|
15
|
+
expect(indexes).to include("client")
|
|
16
|
+
expect(indexes).to include("environment")
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
describe "searching an index that doesn't exist" do
|
|
21
21
|
it "it raises a Ridley::Errors::HTTPNotFound error" do
|
|
22
|
-
|
|
22
|
+
expect {
|
|
23
23
|
connection.search(:notthere)
|
|
24
|
-
}.
|
|
24
|
+
}.to raise_error(Ridley::Errors::HTTPNotFound)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|