spec/acceptance/role_resource_spec.rb in ridley-0.7.0.beta vs spec/acceptance/role_resource_spec.rb in ridley-0.7.0.rc1
- old
+ new
@@ -1,55 +1,53 @@
require 'spec_helper'
describe "Role API operations", type: "acceptance" do
- let(:server_url) { "https://api.opscode.com" }
+ let(:server_url) { "https://api.opscode.com/organizations/ridley" }
let(:client_name) { "reset" }
let(:client_key) { "/Users/reset/.chef/reset.pem" }
- let(:organization) { "ridley" }
let(:connection) do
- Ridley.connection(
+ Ridley.new(
server_url: server_url,
client_name: client_name,
- client_key: client_key,
- organization: organization
+ client_key: client_key
)
end
before(:all) { WebMock.allow_net_connect! }
after(:all) { WebMock.disable_net_connect! }
before(:each) { connection.role.delete_all }
describe "finding a role" do
let(:target) do
- Ridley::Role.new(
+ Ridley::RoleResource.new(
connection,
name: "ridley-test",
description: "a testing role for ridley"
)
end
before(:each) do
connection.role.create(target)
end
- it "returns the target Ridley::Role from the server" do
+ it "returns the target Ridley::RoleResource from the server" do
connection.role.find(target.name).should eql(target)
end
end
describe "creating a role" do
let(:target) do
- Ridley::Role.new(
+ Ridley::RoleResource.new(
connection,
name: "ridley-test",
description: "a testing role for ridley"
)
end
- it "returns a new Ridley::Role" do
+ it "returns a new Ridley::RoleResource" do
connection.role.create(target).should eql(target)
end
it "adds a new role to the server" do
connection.sync do
@@ -60,21 +58,21 @@
end
end
describe "deleting a role" do
let(:target) do
- Ridley::Role.new(
+ Ridley::RoleResource.new(
connection,
name: "ridley-role-one"
)
end
before(:each) do
connection.role.create(target)
end
- it "returns the deleted Ridley::Role resource" do
+ it "returns the deleted Ridley::RoleResource resource" do
connection.role.delete(target).should eql(target)
end
it "removes the role from the server" do
connection.sync do
@@ -101,32 +99,32 @@
role.create(name: "jamie")
role.create(name: "winsor")
end
end
- it "should return an array of Ridley::Role objects" do
+ it "should return an array of Ridley::RoleResource objects" do
connection.sync do
obj = role.all
obj.should have(2).roles
- obj.should each be_a(Ridley::Role)
+ obj.should each be_a(Ridley::RoleResource)
end
end
end
describe "updating a role" do
let(:target) do
- Ridley::Role.new(
+ Ridley::RoleResource.new(
connection,
name: "ridley-role-one"
)
end
before(:each) do
connection.role.create(target)
end
- it "returns an updated Ridley::Role object" do
+ it "returns an updated Ridley::RoleResource object" do
connection.role.update(target).should eql(target)
end
it "saves a new run_list" do
target.run_list = run_list = ["recipe[one]", "recipe[two]"]