spec/acceptance/node_resource_spec.rb in ridley-0.10.2 vs spec/acceptance/node_resource_spec.rb in ridley-0.11.0.rc1

- old
+ new

@@ -2,10 +2,11 @@ describe "Node API operations", type: "acceptance" do let(:server_url) { "https://api.opscode.com/organizations/ridley" } let(:client_name) { "reset" } let(:client_key) { "/Users/reset/.chef/reset.pem" } + let(:resource) { double('node-resource') } let(:connection) do Ridley.new( server_url: server_url, client_name: client_name, @@ -19,16 +20,11 @@ before(:each) do connection.node.delete_all end describe "finding a node" do - let(:target) do - Ridley::NodeResource.new( - connection, - name: "ridley-one" - ) - end + let(:target) { Ridley::NodeObject.new(resource, name: "ridley-one") } before(:each) do connection.node.create(target) end @@ -36,18 +32,13 @@ connection.node.find(target.name).should eql(target) end end describe "creating a node" do - let(:target) do - Ridley::NodeResource.new( - connection, - name: "ridley-one" - ) - end - - it "returns a new Ridley::NodeResource object" do + let(:target) { Ridley::NodeObject.new(resource, name: "ridley-one") } + + it "returns a new Ridley::NodeObject object" do connection.node.create(target).should eql(target) end it "adds a new node to the server" do connection.sync do @@ -57,16 +48,11 @@ end end end describe "deleting a node" do - let(:target) do - Ridley::NodeResource.new( - connection, - name: "ridley-one" - ) - end + let(:target) { Ridley::NodeObject.new(resource, name: "ridley-one") } before(:each) do connection.node.create(target) end @@ -99,26 +85,21 @@ node.create(name: "ridley-one") node.create(name: "ridley-two") end end - it "returns an array of Ridley::NodeResource objects" do + it "returns an array of Ridley::NodeObject" do connection.sync do obj = node.all - - obj.should each be_a(Ridley::NodeResource) + + obj.should each be_a(Ridley::NodeObject) obj.should have(2).nodes end end end describe "updating a node" do - let(:target) do - Ridley::NodeResource.new( - connection, - name: "ridley-one" - ) - end + let(:target) { Ridley::NodeObject.new(resource, name: "ridley-one") } before(:each) do connection.node.create(target) end