The src/features/template.feature file has a trailing line at the EOF.
Please remove it.
With that in mind, ACK.
Thomas
On 02/09/2011 04:36 PM, jzigmund(a)redhat.com wrote:
From: Jozef Zigmund<jzigmund(a)redhat.com>
---
.../image_factory/templates_controller.rb | 4 ++--
src/app/views/image_factory/templates/_list.haml | 2 +-
src/features/step_definitions/template_steps.rb | 5 +++++
src/features/template.feature | 14 ++++++++++++++
4 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/image_factory/templates_controller.rb
b/src/app/controllers/image_factory/templates_controller.rb
index 16ea629..59e099e 100644
--- a/src/app/controllers/image_factory/templates_controller.rb
+++ b/src/app/controllers/image_factory/templates_controller.rb
@@ -185,9 +185,9 @@ class ImageFactory::TemplatesController< ApplicationController
Template.find(params[:selected]).each do |template|
if check_privilege(Privilege::MODIFY, template)
template.destroy
- else
+ else
flash[:error] = "You don't have a permission to delete."
- end
+ end
end
redirect_to image_factory_templates_url
end
diff --git a/src/app/views/image_factory/templates/_list.haml
b/src/app/views/image_factory/templates/_list.haml
index 7675d72..6cec40b 100644
--- a/src/app/views/image_factory/templates/_list.haml
+++ b/src/app/views/image_factory/templates/_list.haml
@@ -12,7 +12,7 @@
- @templates.each do |template|
%tr
%td
- = check_box_tag 'selected[]', template.id, @url_params[:select] ==
'all'
+ = check_box_tag 'selected[]', template.id, @url_params[:select] ==
'all', :id => "selected_#{template.id}"
= image_tag "blnk.png", :alt => template.platform, :class
=> "icon platform #{template.platform}"
= link_to template.name, image_factory_template_path(template)
%td= template.platform
diff --git a/src/features/step_definitions/template_steps.rb
b/src/features/step_definitions/template_steps.rb
index 5bae0a2..4724e1e 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -113,3 +113,8 @@ end
When /^I edit the template$/ do
visit edit_image_factory_template_url(@template)
end
+
+When /^(?:|I )check "([^"]*)" template$/ do |template_name|
+ template = Template.find_by_name(template_name)
+ check("selected_#{template.id}")
+end
diff --git a/src/features/template.feature b/src/features/template.feature
index 47a8d1b..6510772 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -183,3 +183,17 @@ Feature: Manage Templates
Then I should not see "Test1"
And I should see "Other"
And I should not see "Mock"
+
+ Scenario: Delete multiple templates
+ Given there are these templates:
+ | name | platform | platform_version | architecture | summary
|
+ | Test1 | fedora | 13 | x86_64 | Test Template Fedora
13 64 bit Description |
+ | Mock | fedora | 14 | i386 | Test Template Fedora
14 Description |
+ | Other | fedora | 10.04 | i386 | Test Template Ubuntu
10.04 32 bit Description |
+ And I am on the image factory templates page
+ When I check "Test1" template
+ And I check "Mock" template
+ And I press "Delete"
+ Then I should be on the image factory templates page
+ And I should see "Other"
+