ridley 4.2.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 +8 -0
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/lib/ridley/connection.rb +1 -2
- data/lib/ridley/errors.rb +1 -0
- data/lib/ridley/mixin/params_validate.rb +4 -0
- data/lib/ridley/version.rb +1 -1
- data/ridley.gemspec +2 -2
- 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 +124 -118
- 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 +10 -10
- 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 +15 -18
- data/lib/ridley/middleware/gzip.rb +0 -18
- data/spec/unit/ridley/middleware/gzip_spec.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c7d2e45f884fb456322b48859368c420ec0f112
|
4
|
+
data.tar.gz: 0f0e0212abe893d298894fb71f7f2f385b9dd26f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0add3e0c899c30e52d0df48041940020c76508382ac622e3b21f8f9df39a59ccb25f5e6b1353e7ce648ba6b11ed34db644528ffad88fabbdabb909329363d066
|
7
|
+
data.tar.gz: 708ec93b537dd61a8443772c855345813af13de9418b9013928036efb35624465b8fd5938cc820ad3d6391ef7ebef1708294325d58e01500f2c5f9e92bac7607
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 4.3.0
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Switch internal HTTP client from `net_http_persistent` to `httpclient`
|
5
|
+
* Loosen constraint on Hashie to allow for both the 2.x and 3.x line
|
6
|
+
* Bug Fixes
|
7
|
+
* Fix missiong constant ValidationFailed when performing a params validation
|
8
|
+
|
1
9
|
# 4.2.0
|
2
10
|
|
3
11
|
* Enhancements
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Ridley
|
2
2
|
[](http://badge.fury.io/rb/ridley)
|
3
|
-
[](http://travis-ci.org/reset/ridley)
|
4
|
+
[](https://gemnasium.com/reset/ridley)
|
5
|
+
[](https://codeclimate.com/github/reset/ridley)
|
6
6
|
|
7
7
|
A reliable Chef API client with a clean syntax
|
8
8
|
|
@@ -430,4 +430,4 @@ Authors and Contributors
|
|
430
430
|
- Jamie Winsor (<jamie@vialstudios.com>)
|
431
431
|
- Kyle Allan (<kallan@riotgames.com>)
|
432
432
|
|
433
|
-
Thank you to all of our [Contributors](https://github.com/
|
433
|
+
Thank you to all of our [Contributors](https://github.com/reset/ridley/graphs/contributors), testers, and users.
|
data/lib/ridley/connection.rb
CHANGED
@@ -61,10 +61,9 @@ module Ridley
|
|
61
61
|
b.request :chef_auth, client_name, client_key
|
62
62
|
|
63
63
|
b.response :parse_json
|
64
|
-
b.response :gzip
|
65
64
|
b.response :chef_response
|
66
65
|
|
67
|
-
b.adapter :
|
66
|
+
b.adapter :httpclient
|
68
67
|
end
|
69
68
|
|
70
69
|
uri_hash = Ridley::Helpers.options_slice(Addressable::URI.parse(server_url).to_hash, :scheme, :host, :port)
|
data/lib/ridley/errors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ridley/errors'
|
2
|
+
|
1
3
|
module Ridley::Mixin
|
2
4
|
# Borrowed and modified from: {https://raw.github.com/opscode/chef/11.4.0/lib/chef/mixin/params_validate.rb}
|
3
5
|
#
|
@@ -15,6 +17,8 @@ module Ridley::Mixin
|
|
15
17
|
# See the License for the specific language governing permissions and
|
16
18
|
# limitations under the License.
|
17
19
|
module ParamsValidate
|
20
|
+
include Ridley::Errors
|
21
|
+
|
18
22
|
# Takes a hash of options, along with a map to validate them. Returns the original
|
19
23
|
# options hash, plus any changes that might have been made (through things like setting
|
20
24
|
# default values in the validation map)
|
data/lib/ridley/version.rb
CHANGED
data/ridley.gemspec
CHANGED
@@ -27,10 +27,10 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_dependency 'celluloid-io', '~> 0.16.1'
|
28
28
|
s.add_dependency 'erubis'
|
29
29
|
s.add_dependency 'faraday', '~> 0.9.0'
|
30
|
-
s.add_dependency 'hashie', '>= 2.0.2', '<
|
30
|
+
s.add_dependency 'hashie', '>= 2.0.2', '< 4.0.0'
|
31
|
+
s.add_dependency 'httpclient', '~> 2.6'
|
31
32
|
s.add_dependency 'json', '>= 1.7.7'
|
32
33
|
s.add_dependency 'mixlib-authentication', '>= 1.3.0'
|
33
|
-
s.add_dependency 'net-http-persistent', '>= 2.8'
|
34
34
|
s.add_dependency 'retryable', '~> 2.0'
|
35
35
|
s.add_dependency 'semverse', '~> 1.1'
|
36
36
|
|
@@ -11,30 +11,30 @@ describe "Client API operations", type: "acceptance" do
|
|
11
11
|
before { chef_client("reset", admin: false) }
|
12
12
|
|
13
13
|
it "returns a ClientObject" do
|
14
|
-
connection.client.find("reset").
|
14
|
+
expect(connection.client.find("reset")).to be_a(Ridley::ClientObject)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "when the server does not have the client" do
|
19
19
|
it "returns a nil value" do
|
20
|
-
connection.client.find("not_there").
|
20
|
+
expect(connection.client.find("not_there")).to be_nil
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "creating a client" do
|
26
26
|
it "returns a Ridley::ClientObject" do
|
27
|
-
connection.client.create(name: "reset").
|
27
|
+
expect(connection.client.create(name: "reset")).to be_a(Ridley::ClientObject)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "adds a client to the chef server" do
|
31
31
|
old = connection.client.all.length
|
32
32
|
connection.client.create(name: "reset")
|
33
|
-
connection.client.all.
|
33
|
+
expect(connection.client.all.size).to eq(old + 1)
|
34
34
|
end
|
35
35
|
|
36
36
|
it "has a value for #private_key" do
|
37
|
-
connection.client.create(name: "reset").private_key.
|
37
|
+
expect(connection.client.create(name: "reset").private_key).not_to be_nil
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -42,13 +42,13 @@ describe "Client API operations", type: "acceptance" do
|
|
42
42
|
before { chef_client("reset", admin: false) }
|
43
43
|
|
44
44
|
it "returns a Ridley::ClientObject object" do
|
45
|
-
connection.client.delete("reset").
|
45
|
+
expect(connection.client.delete("reset")).to be_a(Ridley::ClientObject)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "removes the client from the server" do
|
49
49
|
connection.client.delete("reset")
|
50
50
|
|
51
|
-
connection.client.find("reset").
|
51
|
+
expect(connection.client.find("reset")).to be_nil
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -59,12 +59,12 @@ describe "Client API operations", type: "acceptance" do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "returns an array of Ridley::ClientObject objects" do
|
62
|
-
connection.client.delete_all.
|
62
|
+
expect(connection.client.delete_all).to each be_a(Ridley::ClientObject)
|
63
63
|
end
|
64
64
|
|
65
65
|
it "deletes all clients from the remote" do
|
66
66
|
connection.client.delete_all
|
67
|
-
connection.client.all.
|
67
|
+
expect(connection.client.all.size).to eq(0)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -75,11 +75,11 @@ describe "Client API operations", type: "acceptance" do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it "returns an array of Ridley::ClientObject objects" do
|
78
|
-
connection.client.all.
|
78
|
+
expect(connection.client.all).to each be_a(Ridley::ClientObject)
|
79
79
|
end
|
80
80
|
|
81
81
|
it "returns all of the clients on the server" do
|
82
|
-
connection.client.all.
|
82
|
+
expect(connection.client.all.size).to eq(4)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -87,7 +87,7 @@ describe "Client API operations", type: "acceptance" do
|
|
87
87
|
before { chef_client("reset", admin: false) }
|
88
88
|
|
89
89
|
it "returns a Ridley::ClientObject object with a value for #private_key" do
|
90
|
-
connection.client.regenerate_key("reset").private_key.
|
90
|
+
expect(connection.client.regenerate_key("reset").private_key).to match(/^-----BEGIN RSA PRIVATE KEY-----/)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -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
|