[PATCH conductor] BZ750957 Redirect to pools pretty view after creating pools

Petr Blaho pblaho at redhat.com
Thu Feb 2 16:16:41 UTC 2012


On Thursday, February 02, 2012 04:30:35 PM jtomasek at redhat.com wrote:
> From: Jiri Tomasek <jtomasek at redhat.com>
> 
> ---
>  src/app/controllers/pools_controller.rb       |    4 +---
>  src/features/pool.feature                     |   20 ++++----------------
>  src/spec/controllers/pools_controller_spec.rb |    3 +--
>  3 files changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
> index 3565721..37ae5a7 100644
> --- a/src/app/controllers/pools_controller.rb
> +++ b/src/app/controllers/pools_controller.rb
> @@ -122,9 +122,7 @@ class PoolsController < ApplicationController
>        if @pool.save
>          @pool.assign_owner_roles(current_user)
>          flash[:notice] = t "pools.flash.notice.added"
> -        format.html { redirect_to :action => 'show', :id => @pool.id }
> -        # TODO - The new UI is almost certainly going to want a new partial for .js
> -        format.js { render :partial => 'show', :id => @pool.id }
> +        format.html { redirect_to pools_path }
>          format.json { render :json => @pool, :status => :created }
>        else
>          flash.now[:warning] = t "pools.flash.warning.creation_failed"
> diff --git a/src/features/pool.feature b/src/features/pool.feature
> index b837dfc..14a9e7a 100644
> --- a/src/features/pool.feature
> +++ b/src/features/pool.feature
> @@ -16,21 +16,10 @@ Feature: Manage Pools
>      And I select "default" from "pool_pool_family_id"
>      And I fill in "quota_instances" with "unlimited"
>      And I press "save_button"
> -    Then I should be on the page for the pool "mockpool"
> +    Then I should be on the pools page
>      And I should see "mockpool"
>      And I should have a pool named "mockpool"
>  
> -  Scenario: Create a new Pool over XHR
> -    Given I request XHR
> -    And I am on the new pool page
> -    Then I should get back a partial
> -    When I fill in "pool_name" with "mockpool"
> -    And I select "default" from "pool_pool_family_id"
> -    And I fill in "quota_instances" with "unlimited"
> -    And I press "save_button"
> -    Then I should get back a partial
> -    And I should see "mockpool"
> -
>    Scenario: View Pool's Quota Usage
>      Given I have Pool Creator permissions on a pool named "mockpool"
>      And the "mockpool" Pool has a quota with following capacities:
> @@ -72,18 +61,17 @@ Feature: Manage Pools
>      When I fill in "pool_name" with "mockpool"
>      And I select "default" from "pool_pool_family_id"
>      And I press "save_button"
> -    Then I should be on the page for the pool "mockpool"
> +    Then I should be on the pools page
>      And I should see a confirmation message
>      And I should see "mockpool"
>      And I should have a pool named "mockpool"
> -    When I go to the pools page
> -    And I follow link with ID "filter_view"
> +    When I follow link with ID "filter_view"
>      And I follow "new_pool_button"
>      Then I should be on the new pool page
>      When I fill in "pool_name" with "foopool"
>      And I select "default" from "pool_pool_family_id"
>      And I press "save_button"
> -    Then I should be on the page for the pool "foopool"
> +    Then I should be on the pools page
>      And I should see a confirmation message
>      And I should have a pool named "mockpool"
>      And I should have a pool named "foopool"
> diff --git a/src/spec/controllers/pools_controller_spec.rb b/src/spec/controllers/pools_controller_spec.rb
> index 25770b1..21af9d0 100644
> --- a/src/spec/controllers/pools_controller_spec.rb
> +++ b/src/spec/controllers/pools_controller_spec.rb
> @@ -46,8 +46,7 @@ describe PoolsController do
>           :enabled => true
>         }
>       end.should change(Pool, :count).by(1)
> -     id = Pool.find(:first, :conditions => ['name = ?', 'foopool']).id
> -     response.should redirect_to(pool_path(id))
> +     response.should redirect_to(pools_path)
>    end
>  
>    it "should allow RESTful delete of a single pool" do
> 
Works, ACK.

-- 

With regards
Petr Blaho



More information about the aeolus-devel mailing list