ridley 0.0.1
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.
- data/.gitignore +17 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/Guardfile +20 -0
- data/LICENSE +201 -0
- data/README.md +273 -0
- data/Thorfile +48 -0
- data/lib/ridley.rb +48 -0
- data/lib/ridley/connection.rb +131 -0
- data/lib/ridley/context.rb +25 -0
- data/lib/ridley/dsl.rb +58 -0
- data/lib/ridley/errors.rb +82 -0
- data/lib/ridley/log.rb +10 -0
- data/lib/ridley/middleware.rb +19 -0
- data/lib/ridley/middleware/chef_auth.rb +45 -0
- data/lib/ridley/middleware/chef_response.rb +28 -0
- data/lib/ridley/middleware/parse_json.rb +107 -0
- data/lib/ridley/resource.rb +305 -0
- data/lib/ridley/resources/client.rb +75 -0
- data/lib/ridley/resources/cookbook.rb +27 -0
- data/lib/ridley/resources/data_bag.rb +75 -0
- data/lib/ridley/resources/data_bag_item.rb +186 -0
- data/lib/ridley/resources/environment.rb +45 -0
- data/lib/ridley/resources/node.rb +34 -0
- data/lib/ridley/resources/role.rb +33 -0
- data/lib/ridley/version.rb +3 -0
- data/ridley.gemspec +39 -0
- data/spec/acceptance/client_resource_spec.rb +135 -0
- data/spec/acceptance/cookbook_resource_spec.rb +46 -0
- data/spec/acceptance/data_bag_item_resource_spec.rb +171 -0
- data/spec/acceptance/data_bag_resource_spec.rb +51 -0
- data/spec/acceptance/environment_resource_spec.rb +171 -0
- data/spec/acceptance/node_resource_spec.rb +218 -0
- data/spec/acceptance/role_resource_spec.rb +200 -0
- data/spec/fixtures/reset.pem +27 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/support/each_matcher.rb +12 -0
- data/spec/support/shared_examples/ridley_resource.rb +237 -0
- data/spec/support/spec_helpers.rb +11 -0
- data/spec/unit/ridley/connection_spec.rb +167 -0
- data/spec/unit/ridley/errors_spec.rb +34 -0
- data/spec/unit/ridley/middleware/chef_auth_spec.rb +14 -0
- data/spec/unit/ridley/middleware/chef_response_spec.rb +213 -0
- data/spec/unit/ridley/middleware/parse_json_spec.rb +74 -0
- data/spec/unit/ridley/resource_spec.rb +214 -0
- data/spec/unit/ridley/resources/client_spec.rb +47 -0
- data/spec/unit/ridley/resources/cookbook_spec.rb +5 -0
- data/spec/unit/ridley/resources/data_bag_item_spec.rb +42 -0
- data/spec/unit/ridley/resources/data_bag_spec.rb +15 -0
- data/spec/unit/ridley/resources/environment_spec.rb +73 -0
- data/spec/unit/ridley/resources/node_spec.rb +5 -0
- data/spec/unit/ridley/resources/role_spec.rb +5 -0
- data/spec/unit/ridley_spec.rb +32 -0
- metadata +451 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Client API operations", type: "acceptance" do
|
4
|
+
let(:server_url) { "https://api.opscode.com" }
|
5
|
+
let(:client_name) { "reset" }
|
6
|
+
let(:client_key) { "/Users/reset/.chef/reset.pem" }
|
7
|
+
let(:organization) { "ridley" }
|
8
|
+
|
9
|
+
let(:connection) do
|
10
|
+
Ridley.connection(
|
11
|
+
server_url: server_url,
|
12
|
+
client_name: client_name,
|
13
|
+
client_key: client_key,
|
14
|
+
organization: organization
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:all) { WebMock.allow_net_connect! }
|
19
|
+
after(:all) { WebMock.disable_net_connect! }
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
connection.client.delete_all
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "finding a client" do
|
26
|
+
let(:target) do
|
27
|
+
Ridley::Client.new(
|
28
|
+
connection,
|
29
|
+
name: "motherbrain-test",
|
30
|
+
admin: false
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
before(:each) do
|
35
|
+
connection.client.create(target)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns a valid Ridley::Client" do
|
39
|
+
connection.sync do
|
40
|
+
obj = client.find(target)
|
41
|
+
|
42
|
+
obj.should be_a(Ridley::Client)
|
43
|
+
obj.should be_valid
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "creating a client" do
|
49
|
+
let(:target) do
|
50
|
+
Ridley::Client.new(
|
51
|
+
connection,
|
52
|
+
name: "motherbrain_test"
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns a Ridley::Client object" do
|
57
|
+
connection.sync do
|
58
|
+
client.create(target).should be_a(Ridley::Client)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
it "has a value for 'private_key'" do
|
63
|
+
connection.sync do
|
64
|
+
client.create(target).private_key.should_not be_nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "deleting a client" do
|
70
|
+
let(:target) do
|
71
|
+
Ridley::Client.new(
|
72
|
+
connection,
|
73
|
+
name: "motherbrain-test",
|
74
|
+
admin: false
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
before(:each) do
|
79
|
+
connection.client.create(target)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "returns a Ridley::Client object" do
|
83
|
+
connection.client.delete(target).should be_a(Ridley::Client)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "deleting all clients" do
|
88
|
+
before(:each) do
|
89
|
+
connection.sync do
|
90
|
+
client.create(name: "ridley-one")
|
91
|
+
client.create(name: "ridley-two")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it "returns an array of Ridley::Client objects" do
|
96
|
+
connection.client.delete_all.should each be_a(Ridley::Client)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "deletes all clients from the remote" do
|
100
|
+
connection.sync do
|
101
|
+
client.delete_all
|
102
|
+
|
103
|
+
client.all.should have(0).clients
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "listing all clients" do
|
109
|
+
it "returns an array of Ridley::Client objects" do
|
110
|
+
connection.client.all.should each be_a(Ridley::Client)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "regenerating a client's private key" do
|
115
|
+
let(:target) do
|
116
|
+
Ridley::Client.new(
|
117
|
+
connection,
|
118
|
+
name: "motherbrain-test",
|
119
|
+
admin: false
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
before(:each) do
|
124
|
+
connection.client.create(target)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "returns a Ridley::Client object with a value for 'private_key'" do
|
128
|
+
connection.sync do
|
129
|
+
obj = client.regenerate_key(target)
|
130
|
+
|
131
|
+
obj.private_key.should match(/^-----BEGIN RSA PRIVATE KEY-----/)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Cookbook API operations", type: "acceptance" do
|
4
|
+
let(:server_url) { "https://api.opscode.com" }
|
5
|
+
let(:client_name) { "reset" }
|
6
|
+
let(:client_key) { "/Users/reset/.chef/reset.pem" }
|
7
|
+
let(:organization) { "ridley" }
|
8
|
+
|
9
|
+
let(:connection) do
|
10
|
+
Ridley.connection(
|
11
|
+
server_url: server_url,
|
12
|
+
client_name: client_name,
|
13
|
+
client_key: client_key,
|
14
|
+
organization: organization
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:all) { WebMock.allow_net_connect! }
|
19
|
+
after(:all) { WebMock.disable_net_connect! }
|
20
|
+
|
21
|
+
describe "finding a cookbook" do
|
22
|
+
pending
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "creating a cookbook" do
|
26
|
+
pending
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "deleting a cookbook" do
|
30
|
+
pending
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "deleting all cookbooks" do
|
34
|
+
pending
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "listing all cookbooks" do
|
38
|
+
it "should return an array of environment objects" do
|
39
|
+
connection.cookbook.all.should each be_a(Ridley::Cookbook)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "updating a cookbook" do
|
44
|
+
pending
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "DataBag API operations", type: "acceptance" do
|
4
|
+
let(:server_url) { "https://api.opscode.com" }
|
5
|
+
let(:client_name) { "reset" }
|
6
|
+
let(:client_key) { "/Users/reset/.chef/reset.pem" }
|
7
|
+
let(:organization) { "ridley" }
|
8
|
+
|
9
|
+
let(:connection) do
|
10
|
+
Ridley.connection(
|
11
|
+
server_url: server_url,
|
12
|
+
client_name: client_name,
|
13
|
+
client_key: client_key,
|
14
|
+
organization: organization
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:all) { WebMock.allow_net_connect! }
|
19
|
+
after(:all) { WebMock.disable_net_connect! }
|
20
|
+
|
21
|
+
before(:all) do
|
22
|
+
connection.data_bag.delete_all
|
23
|
+
@databag = connection.data_bag.create(name: "ridley-test")
|
24
|
+
end
|
25
|
+
|
26
|
+
before(:each) do
|
27
|
+
@databag.item.delete_all
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "listing data bag items" do
|
31
|
+
context "when the data bag has no items" do
|
32
|
+
before(:each) do
|
33
|
+
@databag.item.delete_all
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns an empty array" do
|
37
|
+
@databag.item.all.should have(0).items
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "when the data bag has items" do
|
42
|
+
before(:each) do
|
43
|
+
@databag.item.create(id: "one")
|
44
|
+
@databag.item.create(id: "two")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns an array with each item" do
|
48
|
+
@databag.item.all.should have(2).items
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "creating a data bag item" do
|
54
|
+
it "adds a data bag item to the collection of data bag items" do
|
55
|
+
@databag.item.create(id: "appconfig", host: "host.local", port: 80, admin: false, servers: ["one"])
|
56
|
+
|
57
|
+
@databag.item.all.should have(1).item
|
58
|
+
end
|
59
|
+
|
60
|
+
context "when an 'id' field is missing" do
|
61
|
+
it "raises an Ridley::Errors::InvalidResource error" do
|
62
|
+
lambda {
|
63
|
+
@databag.item.create(name: "jamie")
|
64
|
+
}.should raise_error(Ridley::Errors::InvalidResource)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "retrieving a data bag item" do
|
70
|
+
it "returns the desired item in the data bag" do
|
71
|
+
attributes = {
|
72
|
+
id: "appconfig", host: "host.local", port: 80, admin: false, servers: ["one"]
|
73
|
+
}
|
74
|
+
@databag.item.create(attributes)
|
75
|
+
|
76
|
+
@databag.item.find("appconfig").to_hash.should eql(attributes)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "deleting a data bag item" do
|
81
|
+
let(:attributes) do
|
82
|
+
{
|
83
|
+
id: "appconfig",
|
84
|
+
host: "host.local"
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
before(:each) do
|
89
|
+
@databag.item.create(attributes)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "returns the deleted data bag item" do
|
93
|
+
dbi = @databag.item.delete(attributes[:id])
|
94
|
+
|
95
|
+
dbi.should be_a(Ridley::DataBagItem)
|
96
|
+
dbi.attributes.should eql(attributes)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "deletes the data bag item from the server" do
|
100
|
+
@databag.item.delete(attributes[:id])
|
101
|
+
|
102
|
+
@databag.item.find(attributes[:id]).should be_nil
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "deleting all data bag items in a data bag" do
|
107
|
+
before(:each) do
|
108
|
+
@databag.item.create(id: "one")
|
109
|
+
@databag.item.create(id: "two")
|
110
|
+
end
|
111
|
+
|
112
|
+
it "returns the array of deleted data bag items" do
|
113
|
+
@databag.item.delete_all.should each be_a(Ridley::DataBagItem)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "removes all data bag items from the data bag" do
|
117
|
+
@databag.item.delete_all
|
118
|
+
|
119
|
+
@databag.item.all.should have(0).items
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "updating a data bag item" do
|
124
|
+
before(:each) do
|
125
|
+
@databag.item.create(id: "one")
|
126
|
+
end
|
127
|
+
|
128
|
+
it "returns the updated data bag item" do
|
129
|
+
dbi = @databag.item.update(id: "one", name: "brooke")
|
130
|
+
|
131
|
+
dbi[:name].should eql("brooke")
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "saving a data bag item" do
|
136
|
+
context "when the data bag item exists" do
|
137
|
+
before(:each) do
|
138
|
+
@dbi = @databag.item.create(id: "ridley-test")
|
139
|
+
end
|
140
|
+
|
141
|
+
it "returns true if successful" do
|
142
|
+
@dbi[:name] = "brooke"
|
143
|
+
@dbi.save.should be_true
|
144
|
+
end
|
145
|
+
|
146
|
+
it "creates a new data bag item on the remote" do
|
147
|
+
@dbi[:name] = "brooke"
|
148
|
+
@dbi.save
|
149
|
+
|
150
|
+
@databag.item.all.should have(1).item
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context "when the data bag item does not exist" do
|
155
|
+
it "returns true if successful" do
|
156
|
+
dbi = @databag.item.new
|
157
|
+
|
158
|
+
dbi.attributes = { id: "not-there", name: "brooke" }
|
159
|
+
dbi.save.should be_true
|
160
|
+
end
|
161
|
+
|
162
|
+
it "creates a new data bag item on the remote" do
|
163
|
+
dbi = @databag.item.new
|
164
|
+
dbi.attributes = { id: "not-there", name: "brooke" }
|
165
|
+
dbi.save
|
166
|
+
|
167
|
+
@databag.item.all.should have(1).item
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "DataBag API operations", type: "acceptance" do
|
4
|
+
let(:server_url) { "https://api.opscode.com" }
|
5
|
+
let(:client_name) { "reset" }
|
6
|
+
let(:client_key) { "/Users/reset/.chef/reset.pem" }
|
7
|
+
let(:organization) { "ridley" }
|
8
|
+
|
9
|
+
let(:connection) do
|
10
|
+
Ridley.connection(
|
11
|
+
server_url: server_url,
|
12
|
+
client_name: client_name,
|
13
|
+
client_key: client_key,
|
14
|
+
organization: organization
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:all) { WebMock.allow_net_connect! }
|
19
|
+
after(:all) { WebMock.disable_net_connect! }
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
connection.data_bag.delete_all
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "listing data bags" do
|
26
|
+
context "when no data bags exist" do
|
27
|
+
it "returns an empty array" do
|
28
|
+
connection.data_bag.all.should have(0).items
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when the server has data bags" do
|
33
|
+
before(:each) do
|
34
|
+
connection.data_bag.create(name: "ridley-one")
|
35
|
+
connection.data_bag.create(name: "ridley-two")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns an array of data bags" do
|
39
|
+
connection.data_bag.all.should each be_a(Ridley::DataBag)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns all of the data bags on the server" do
|
43
|
+
connection.data_bag.all.should have(2).items
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "creating a data bag" do
|
49
|
+
pending
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Environment API operations", type: "acceptance" do
|
4
|
+
let(:server_url) { "https://api.opscode.com" }
|
5
|
+
let(:client_name) { "reset" }
|
6
|
+
let(:client_key) { "/Users/reset/.chef/reset.pem" }
|
7
|
+
let(:organization) { "ridley" }
|
8
|
+
|
9
|
+
let(:connection) do
|
10
|
+
Ridley.connection(
|
11
|
+
server_url: server_url,
|
12
|
+
client_name: client_name,
|
13
|
+
client_key: client_key,
|
14
|
+
organization: organization
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:all) { WebMock.allow_net_connect! }
|
19
|
+
after(:all) { WebMock.disable_net_connect! }
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
connection.environment.delete_all
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "finding an environment" do
|
26
|
+
let(:target) do
|
27
|
+
Ridley::Environment.new(
|
28
|
+
connection,
|
29
|
+
name: "ridley-test-env"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
before(:each) do
|
34
|
+
connection.environment.create(target)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "returns a valid Ridley::Environment object" do
|
38
|
+
connection.sync do
|
39
|
+
obj = environment.find(target)
|
40
|
+
|
41
|
+
obj.should be_a(Ridley::Environment)
|
42
|
+
obj.should be_valid
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "creating an environment" do
|
48
|
+
let(:target) do
|
49
|
+
Ridley::Environment.new(
|
50
|
+
connection,
|
51
|
+
name: "ridley-test-env",
|
52
|
+
description: "a testing environment for ridley"
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns a valid Ridley::Environment object" do
|
57
|
+
connection.sync do
|
58
|
+
obj = environment.create(target)
|
59
|
+
|
60
|
+
obj.should be_a(Ridley::Environment)
|
61
|
+
obj.should be_valid
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "deleting an environment" do
|
67
|
+
it "raises Ridley::Errors::HTTPMethodNotAllowed when attempting to delete the '_default' environment" do
|
68
|
+
lambda {
|
69
|
+
connection.environment.delete("_default")
|
70
|
+
}.should raise_error(Ridley::Errors::HTTPMethodNotAllowed)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "deleting all environments" do
|
75
|
+
before(:each) do
|
76
|
+
connection.sync do
|
77
|
+
environment.create(name: "ridley-one")
|
78
|
+
environment.create(name: "ridley-two")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
it "returns an array of Ridley::Environment objects" do
|
83
|
+
connection.environment.delete_all.should each be_a(Ridley::Environment)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "deletes all environments but '_default' from the remote" do
|
87
|
+
connection.sync do
|
88
|
+
environment.delete_all
|
89
|
+
|
90
|
+
environment.all.should have(1).clients
|
91
|
+
environment.find("_default").should_not be_nil
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "listing all environments" do
|
97
|
+
it "should return an array of Ridley::Environment objects" do
|
98
|
+
connection.environment.all.should each be_a(Ridley::Environment)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "updating an environment" do
|
103
|
+
let(:target) do
|
104
|
+
Ridley::Environment.new(
|
105
|
+
connection,
|
106
|
+
name: "ridley-env-test"
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
110
|
+
before(:each) do
|
111
|
+
connection.environment.create(target)
|
112
|
+
end
|
113
|
+
|
114
|
+
it "saves a new 'description'" do
|
115
|
+
target.description = description = "ridley testing environment"
|
116
|
+
|
117
|
+
connection.sync do
|
118
|
+
environment.update(target)
|
119
|
+
obj = environment.find(target)
|
120
|
+
|
121
|
+
obj.description.should eql(description)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it "saves a new set of 'default_attributes'" do
|
126
|
+
target.default_attributes = default_attributes = {
|
127
|
+
attribute_one: "val_one",
|
128
|
+
nested: {
|
129
|
+
other: "val"
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
connection.sync do
|
134
|
+
environment.update(target)
|
135
|
+
obj = environment.find(target)
|
136
|
+
|
137
|
+
obj.default_attributes.should eql(default_attributes)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
it "saves a new set of 'override_attributes'" do
|
142
|
+
target.override_attributes = override_attributes = {
|
143
|
+
attribute_one: "val",
|
144
|
+
nested: {
|
145
|
+
other: "val"
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
connection.sync do
|
150
|
+
environment.update(target)
|
151
|
+
obj = environment.find(target)
|
152
|
+
|
153
|
+
obj.override_attributes.should eql(override_attributes)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
it "saves a new set of 'cookbook_versions'" do
|
158
|
+
target.cookbook_versions = cookbook_versions = {
|
159
|
+
nginx: "1.2.0",
|
160
|
+
tomcat: "1.3.0"
|
161
|
+
}
|
162
|
+
|
163
|
+
connection.sync do
|
164
|
+
environment.update(target)
|
165
|
+
obj = environment.find(target)
|
166
|
+
|
167
|
+
obj.cookbook_versions.should eql(cookbook_versions)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|