ACK to the series
On 01/26/2011 03:42 PM, mtaylor(a)redhat.com wrote:
From: Martyn Taylor<mtaylor(a)redhat.com>
---
src/features/step_definitions/template_steps.rb | 12 ++++++
src/features/template.feature | 43 +++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/src/features/step_definitions/template_steps.rb
b/src/features/step_definitions/template_steps.rb
index 24dea3b..79a6739 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -42,6 +42,18 @@ Given /^I jump on the "([^"]*)" template software
page$/ do |name|
visit url_for(:action => 'software', :controller =>
'templates', :id => @template)
end
+Given /^there are these templates:$/ do |table|
+ table.hashes.each do |hash|
+ @template = Factory.build (:template, :name => hash['name'],
+ :platform => hash['platform'])
+ @template.save!
+ @template.platform_version = hash['platform_version']
+ @template.architecture = hash['architecture']
+ @template.summary = hash['summary']
+ @template.save!
+ end
+end
+
Then /^I should have a template named "([^"]*)"$/ do |name|
Template.first(:order => 'created_at DESC').xml.name.should eql(name)
end
diff --git a/src/features/template.feature b/src/features/template.feature
index 272573a..b7d75a8 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -124,3 +124,46 @@ Feature: Manage Templates
And I press "Build"
Then I should be on the templates page
And I should see "Build imported template is not supported"
+
+ Scenario: Search for 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
+ Then I should see the following:
+ | NAME | OS | VERSION | ARCH |
+ | Test1 | fedora | 13 | x86_64 |
+ | Mock | fedora | 14 | i386 |
+ | Other | fedora | 10.04 | i386 |
+ When I fill in "q" with "test"
+ And I press "Search"
+ Then I should see "Test1"
+ And I should see "Mock"
+ And I should see "Other"
+ When I fill in "q" with "Mock"
+ And I press "Search"
+ Then I should see "Mock"
+ And I should not see "Test1"
+ And I should not see "Other"
+ When I fill in "q" with "13"
+ And I press "Search"
+ Then I should see "Test1"
+ And I should not see "Other"
+ And I should not see "Mock"
+ When I fill in "q" with "x86_64"
+ And I press "Search"
+ Then I should see "Test1"
+ And I should not see "Other"
+ And I should not see "Mock"
+ When I fill in "q" with "fedora"
+ And I press "Search"
+ Then I should see "Test1"
+ And I should see "Other"
+ And I should see "Mock"
+ When I fill in "q" with "32 bit Description"
+ And I press "Search"
+ Then I should not see "Test1"
+ And I should see "Other"
+ And I should not see "Mock"
\ No newline at end of file