spec/acceptance/role_resource_spec.rb in ridley-0.11.2 vs spec/acceptance/role_resource_spec.rb in ridley-0.12.0.rc1
- old
+ new
@@ -21,15 +21,12 @@
it "returns a new Ridley::RoleObject" do
connection.role.create(name: role_name).should be_a(Ridley::RoleObject)
end
it "adds a new role to the server" do
- connection.sync do
- role.create(name: role_name)
-
- role.all.should have(1).role
- end
+ connection.role.create(name: role_name)
+ connection.role.all.should have(1).role
end
end
describe "deleting a role" do
let(:role_name) { "ridley-role" }
@@ -38,46 +35,40 @@
it "returns the deleted Ridley::RoleObject resource" do
connection.role.delete(role_name).should be_a(Ridley::RoleObject)
end
it "removes the role from the server" do
- connection.sync do
- role.delete(role_name)
+ connection.role.delete(role_name)
- role.find(role_name).should be_nil
- end
+ connection.role.find(role_name).should be_nil
end
end
describe "deleting all roles" do
before do
chef_role("role_one")
chef_role("role_two")
end
it "deletes all nodes from the remote server" do
- connection.sync do
- role.delete_all
+ connection.role.delete_all
- role.all.should have(0).roles
- end
+ connection.role.all.should have(0).roles
end
end
describe "listing all roles" do
before do
chef_role("role_one")
chef_role("role_two")
end
it "should return an array of Ridley::RoleObject" do
- connection.sync do
- obj = role.all
+ obj = connection.role.all
- obj.should have(2).roles
- obj.should each be_a(Ridley::RoleObject)
- end
+ obj.should have(2).roles
+ obj.should each be_a(Ridley::RoleObject)
end
end
describe "updating a role" do
let(:role_name) { "ridley-role" }
@@ -89,71 +80,61 @@
end
it "saves a new run_list" do
target.run_list = run_list = ["recipe[one]", "recipe[two]"]
- connection.sync do
- role.update(target)
- obj = role.find(target)
+ connection.role.update(target)
+ obj = connection.role.find(target)
- obj.run_list.should eql(run_list)
- end
+ obj.run_list.should eql(run_list)
end
it "saves a new env_run_lists" do
target.env_run_lists = env_run_lists = {
"production" => ["recipe[one]"],
"development" => ["recipe[two]"]
}
- connection.sync do
- role.update(target)
- obj = role.find(target)
+ connection.role.update(target)
+ obj = connection.role.find(target)
- obj.env_run_lists.should eql(env_run_lists)
- end
+ obj.env_run_lists.should eql(env_run_lists)
end
it "saves a new description" do
target.description = description = "a new description!"
- connection.sync do
- role.update(target)
- obj = role.find(target)
+ connection.role.update(target)
+ obj = connection.role.find(target)
- obj.description.should eql(description)
- end
+ obj.description.should eql(description)
end
it "saves a new default_attributes" do
target.default_attributes = defaults = {
"attribute_one" => "value_one",
"nested" => {
"other" => false
}
}
- connection.sync do
- role.update(target)
- obj = role.find(target)
+ connection.role.update(target)
+ obj = connection.role.find(target)
- obj.default_attributes.should eql(defaults)
- end
+ obj.default_attributes.should eql(defaults)
end
it "saves a new override_attributes" do
target.override_attributes = overrides = {
"attribute_two" => "value_two",
"nested" => {
"other" => false
}
}
- connection.sync do
- role.update(target)
- obj = role.find(target)
+ connection.role.update(target)
+ obj = connection.role.find(target)
- obj.override_attributes.should eql(overrides)
- end
+ obj.override_attributes.should eql(overrides)
end
end
end