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

- old
+ new

@@ -2,10 +2,11 @@ describe "Environment 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('environment-resource') } let(:connection) do Ridley.new( server_url: server_url, client_name: client_name, @@ -19,45 +20,40 @@ before(:each) do connection.environment.delete_all end describe "finding an environment" do - let(:target) do - Ridley::EnvironmentResource.new( - connection, - name: "ridley-test-env" - ) - end + let(:target) { Ridley::EnvironmentObject.new(resource, name: "ridley-test-env") } before(:each) do connection.environment.create(target) end - it "returns a valid Ridley::EnvironmentResource object" do + it "returns a valid Ridley::EnvironmentObject object" do connection.sync do obj = environment.find(target) - obj.should be_a(Ridley::EnvironmentResource) + obj.should be_a(Ridley::EnvironmentObject) obj.should be_valid end end end describe "creating an environment" do let(:target) do - Ridley::EnvironmentResource.new( - connection, + Ridley::EnvironmentObject.new( + resource, name: "ridley-test-env", description: "a testing environment for ridley" ) end - it "returns a valid Ridley::EnvironmentResource object" do + it "returns a valid Ridley::EnvironmentObject object" do connection.sync do obj = environment.create(target) - obj.should be_a(Ridley::EnvironmentResource) + obj.should be_a(Ridley::EnvironmentObject) obj.should be_valid end end end @@ -75,12 +71,12 @@ environment.create(name: "ridley-one") environment.create(name: "ridley-two") end end - it "returns an array of Ridley::EnvironmentResource objects" do - connection.environment.delete_all.should each be_a(Ridley::EnvironmentResource) + it "returns an array of Ridley::EnvironmentObject objects" do + connection.environment.delete_all.should each be_a(Ridley::EnvironmentObject) end it "deletes all environments but '_default' from the remote" do connection.sync do environment.delete_all @@ -90,21 +86,16 @@ end end end describe "listing all environments" do - it "should return an array of Ridley::EnvironmentResource objects" do - connection.environment.all.should each be_a(Ridley::EnvironmentResource) + it "should return an array of Ridley::EnvironmentObject objects" do + connection.environment.all.should each be_a(Ridley::EnvironmentObject) end end describe "updating an environment" do - let(:target) do - Ridley::EnvironmentResource.new( - connection, - name: "ridley-env-test" - ) - end + let(:target) { Ridley::EnvironmentObject.new(resource, name: "ridley-test-env") } before(:each) do connection.environment.create(target) end