[PATCH conductor] Make some more tests i18n-independent
Jirka Tomasek
jtomasek at redhat.com
Fri Feb 3 15:48:16 UTC 2012
On 02/03/2012 03:56 PM, tsedovic at redhat.com wrote:
> From: Tomas Sedovic<tomas at sedovic.cz>
>
> Another piece to the ongoing effort to have all tests independent on
> localization.
> ---
> src/features/deployables.feature | 15 +++++++--------
> src/features/image.feature | 2 +-
> src/features/pool_family.feature | 3 +--
> src/features/support/paths.rb | 7 +++++++
> .../controllers/deployables_controller_spec.rb | 10 +++++-----
> 5 files changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/src/features/deployables.feature b/src/features/deployables.feature
> index 922b02a..a27f8ef 100644
> --- a/src/features/deployables.feature
> +++ b/src/features/deployables.feature
> @@ -11,14 +11,13 @@ Feature: Manage Catalog Entries
> Scenario: Create new catalog entry
> Given there is a "default" catalog
> When I am on the "default" catalog catalog entries page
> - Then I should see "Deployables"
> - When I follow "new_catalog_entry_button"
> - Then I should see "Add New Deployable"
> + And I follow "new_catalog_entry_button"
> + Then I should be on the new deployable page for "default"
> When I fill in "deployable[name]" with "test1"
> And I fill in "deployable[description]" with "description"
> When I attach the file "features/upload_files/deployable.xml" to "deployable[xml]"
> And I press "save_button"
> - Then I should see "Deployable added"
> + Then I should see a confirmation message
>
> Scenario: Change the name
> Given there is a "default" catalog
> @@ -26,10 +25,10 @@ Feature: Manage Catalog Entries
> When I am on the "default" catalog catalog entries page
> When I follow "testdepl"
> And I follow "edit_button"
> - Then I should see "Editing Deployable"
> + Then I should be on the edit deployable page for "testdepl"
> When I fill in "deployable[name]" with "testdepl-renamed"
> And I press "save_button"
> - Then I should see "Deployable updated successfully!"
> + Then I should see a confirmation message
> And I should see "testdepl-renamed"
>
> Scenario: Show catalog entry details
> @@ -59,7 +58,7 @@ Feature: Manage Catalog Entries
> And I press "delete_button"
> Then I should be on the "default" catalog page
> And there should be only 0 catalog entries for "default" catalog
> - And I should see "2 deployables testdepl1, testdepl2 were deleted!"
> + And I should see a confirmation message
>
> Scenario: Delete deployable
> Given there is a "default" catalog
> @@ -69,7 +68,7 @@ Feature: Manage Catalog Entries
> And I press "delete"
> Then I should be on the "default" catalog page
> And there should be only 0 catalog entries for "default" catalog
> - And I should see "Deployable testdepl1 delete successfully!"
> + And I should see a confirmation message
>
> #Scenario: Search Catalog Entries
> # Given there is a "testcatalog" catalog
> diff --git a/src/features/image.feature b/src/features/image.feature
> index 4e901d5..8ebfd4c 100644
> --- a/src/features/image.feature
> +++ b/src/features/image.feature
> @@ -12,7 +12,7 @@ Feature: Manage Images
> And I am on the new image page for "testpoolfamily"
> When I fill in "name" with "my template"
> And I press "file_button"
> - Then I should see "You must specify the template XML file"
> + Then I should see an error message
>
> Scenario: Edit an invalid XML when creating an image
> Given there is a pool family named "testpoolfamily"
> diff --git a/src/features/pool_family.feature b/src/features/pool_family.feature
> index 3bcc1f5..a7589e2 100644
> --- a/src/features/pool_family.feature
> +++ b/src/features/pool_family.feature
> @@ -25,8 +25,7 @@ Feature: Pool Families
> Given I am logged in
> And I can view pool family "testpoolfamily"
> When I go to the pool families page
> - Then I should see "Pool Families"
> - And I should not see "testpoolfamily"
> + Then I should not see "testpoolfamily"
>
> Scenario: Show pool family details
> Given I am an authorised user
> diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
> index 2b44259..3a7796e 100644
> --- a/src/features/support/paths.rb
> +++ b/src/features/support/paths.rb
> @@ -186,6 +186,13 @@ module NavigationHelpers
> when /^the "(.*)" catalog catalog entries page/
> url_for catalog_deployables_path(Catalog.find_by_name($1))
>
> + when /^the new deployable page for "(.*)"/
> + url_for new_catalog_deployable_path(Catalog.find_by_name($1))
> +
> + when /^the edit deployable page for "(.*)"/
> + deployable = Deployable.find_by_name $1
> + url_for edit_catalog_deployable_path(deployable.catalogs.first, deployable)
> +
> # Add more mappings here.
> # Here is an example that pulls values out of the Regexp:
> #
> diff --git a/src/spec/controllers/deployables_controller_spec.rb b/src/spec/controllers/deployables_controller_spec.rb
> index ec96d7c..699f0b3 100644
> --- a/src/spec/controllers/deployables_controller_spec.rb
> +++ b/src/spec/controllers/deployables_controller_spec.rb
> @@ -64,7 +64,7 @@ describe DeployablesController do
>
> it "deletes a deployable and appears flash notice" do
> delete :destroy, :id => @deployable.id
> - flash[:notice].should eql("Deployable test_delete delete successfully!")
> + flash[:notice].should_not be_empty
> end
> end
>
> @@ -80,7 +80,7 @@ describe DeployablesController do
>
> it "not delete a deployable and shows flash error" do
> delete :destroy, :id => @deployable.id
> - flash[:error].should eql("Deployable test_delete delete failed!")
> + flash[:error].should_not be_empty
> end
> end
> end
> @@ -99,20 +99,20 @@ describe DeployablesController do
>
> it "deletes both deployables and shows flash notice" do
> delete :multi_destroy, :deployables_selected => [@deployable1.id, @deployable2.id]
> - flash[:notice].should eql("2 deployables #{@deployable1.name}, #{@deployable2.name} were deleted!")
> + flash[:notice].should_not be_empty
> end
>
> it "not delete deployable1 but not deployable2 and shows flash notice and error" do
> Deployable.any_instance.stub(:destroy).and_return(false)
> delete :multi_destroy, :deployables_selected => [@deployable1.id, @deployable2.id]
> - flash[:error].should eql("2 deployables #{@deployable1.name}, #{@deployable2.name} were not deleted!")
> + flash[:error].should_not be_empty
> end
> end
>
> context "without params[:deployables_selected]" do
> it "not delete a deployable and shows flash error" do
> delete :multi_destroy
> - flash[:error].should eql("No deployable was not selected!")
> + flash[:error].should_not be_empty
> end
> end
> end
ACK
Jirka
More information about the aeolus-devel
mailing list