---
src/app/controllers/catalogs_controller.rb | 7 ++++---
src/config/locales/en.yml | 3 +++
src/features/catalogs.feature | 11 +++++++++++
src/features/step_definitions/catalog_steps.rb | 7 ++++++-
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/app/controllers/catalogs_controller.rb
b/src/app/controllers/catalogs_controller.rb
index 59b0eca..80fda58 100644
--- a/src/app/controllers/catalogs_controller.rb
+++ b/src/app/controllers/catalogs_controller.rb
@@ -81,11 +81,12 @@ class CatalogsController < ApplicationController
end
def multi_destroy
- Catalog.find(params[:catalogs_selected]).to_a.each do |catalog|
+ catalogs = Catalog.find(params[:catalogs_selected])
+ catalogs.to_a.each do |catalog|
require_privilege(Privilege::MODIFY, catalog)
catalog.destroy
end
- redirect_to catalogs_path
+ redirect_to catalogs_path, :notice => t("catalogs.deleted", :count =>
catalogs.count)
end
def destroy
@@ -94,7 +95,7 @@ class CatalogsController < ApplicationController
catalog.destroy
respond_to do |format|
- format.html { redirect_to catalogs_path }
+ format.html { redirect_to catalogs_path, :notice =>
t("catalogs.deleted", :count => 1) }
end
end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 84ba31d..aea12d3 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -186,6 +186,9 @@ en:
created:
one: Catalog created!
many: Catalogs created!
+ deleted:
+ one: Catalog deleted!
+ other: "%{count} Catalogs deleted!"
deployables:
index:
deployables: Deployables
diff --git a/src/features/catalogs.feature b/src/features/catalogs.feature
index 3525246..29e9e8e 100644
--- a/src/features/catalogs.feature
+++ b/src/features/catalogs.feature
@@ -42,3 +42,14 @@ Feature: Manage Catalogs
And I press "delete"
Then I should be on the catalogs page
And I should not see "Bad"
+ And I should see "Catalog deleted!"
+
+ Scenario: Delete multiple catalogs
+ Given there is a "Bad" catalog
+ And there is a "Worse" catalog
+ And I am on the catalogs page
+ When I check "Bad" catalog
+ And I check "Worse" catalog
+ And I press "delete_button"
+ Then I should be on the catalogs page
+ And I should see "2 Catalogs deleted!"
diff --git a/src/features/step_definitions/catalog_steps.rb
b/src/features/step_definitions/catalog_steps.rb
index bcc87c0..2fe2a59 100644
--- a/src/features/step_definitions/catalog_steps.rb
+++ b/src/features/step_definitions/catalog_steps.rb
@@ -1,3 +1,8 @@
Given /^there is a "([^"]*)" catalog$/ do |name|
FactoryGirl.create :catalog, :name => name
-end
\ No newline at end of file
+end
+
+When /^I check "([^"]*)" catalog/ do |arg1|
+ catalog = Catalog.find_by_name(arg1)
+ check("catalog_checkbox_#{catalog.id}")
+end
--
1.7.6
_______________________________________________
aeolus-devel mailing list
aeolus-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/aeolus-devel