---
src/features/pool.feature | 11 ---------
src/spec/controllers/pools_controller_spec.rb | 28 +++++++++++++++++++++++++
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/features/pool.feature b/src/features/pool.feature
index de7f2cc..9422a17 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -152,17 +152,6 @@ Feature: Manage Pools
And I should see "Deployment Name"
And I should see "mockdeployment"
- #Scenario: Create a pool and get JSON response
- # Given I accept JSON
- # When I create a pool
- # Then I should get back a pool in JSON format
-
- #Scenario: Delete a pool
- # Given a pool "mockpool" exists
- # And I accept JSON
- # When I delete "mockpool" pool
- # Then I should get back JSON object with success and errors
-
Scenario: Switch pretty view to filtred view on pools index
Given I am on the pools page
And I see "Overview"
diff --git a/src/spec/controllers/pools_controller_spec.rb
b/src/spec/controllers/pools_controller_spec.rb
index 0795941..652dd42 100644
--- a/src/spec/controllers/pools_controller_spec.rb
+++ b/src/spec/controllers/pools_controller_spec.rb
@@ -72,4 +72,32 @@ describe PoolsController do
end.should change(Pool, :count).by(-2)
end
+ context "JSON format responses for " do
+ before do
+ accept_json
+ UserSession.create(@admin)
+ end
+
+ describe "#create" do
+ before do
+ @pool_attributes = Factory.attributes_for(:pool)
+ post :create, :pool => @pool_attributes
+ end
+
+ it { response.should be_success }
+ it { ActiveSupport::JSON.decode(response.body)["name"].should ==
@pool_attributes[:name] }
+ it { ActiveSupport::JSON.decode(response.body)["enabled"].should ==
@pool_attributes[:enabled] }
+ end
+
+ describe "#destroy" do
+ before do
+ @pool = Factory.build(:pool)
+ Pool.stub!(:find).and_return([@pool])
+ delete :multi_destroy, :pools_selected => [@pool.id], :format => :json
+ end
+
+ it { response.should be_success }
+ it { ActiveSupport::JSON.decode(response.body)["success"].should ==
[@pool.name] }
+ end
+ end
end
--
1.7.6