From: Tomas Sedovic <tsedovic(a)redhat.com>
---
.../image_factory/deployables_controller.rb | 7 +++++++
src/features/deployable.feature | 19 +++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/app/controllers/image_factory/deployables_controller.rb
b/src/app/controllers/image_factory/deployables_controller.rb
index 05e9596..e809926 100644
--- a/src/app/controllers/image_factory/deployables_controller.rb
+++ b/src/app/controllers/image_factory/deployables_controller.rb
@@ -4,6 +4,13 @@ class ImageFactory::DeployablesController < ApplicationController
before_filter :load_deployable_with_assemblies, :only => [:remove_assemblies,
:add_assemblies, :pick_assemblies]
def index
+ @search_term = params[:q]
+ return if @search_term.blank?
+
+ search = Deployable.search() do
+ keywords(params[:q])
+ end
+ @deployables = search.results
end
def show
diff --git a/src/features/deployable.feature b/src/features/deployable.feature
index 7e1da9a..fa6cf56 100644
--- a/src/features/deployable.feature
+++ b/src/features/deployable.feature
@@ -72,3 +72,22 @@ Feature: Manage Deployables
And I press "Remove Selected"
Then I should see "Assemblies removed."
And I should not see "Apache"
+
+ Scenario: Search for deployables
+ Given there is a deployable named "first"
+ And there is a deployable named "second"
+ And I am on the image factory deployables page
+ Then I should see "first"
+ And I should see "second"
+ When I fill in "q" with "first"
+ And I press "Search"
+ Then I should see "first"
+ And I should not see "second"
+ When I fill in "q" with "second"
+ And I press "Search"
+ Then I should see "second"
+ And I should not see "first"
+ When I fill in "q" with ""
+ And I press "Search"
+ Then I should see "first"
+ And I should see "second"
--
1.7.4.4