From fe42de3a48a43ccea2bb60c8dcdb4d6665a72eef Mon Sep 17 00:00:00 2001
From: Kamil Trzcinski <ayufan@ayufan.eu>
Date: Tue, 15 Sep 2015 22:13:01 +0200
Subject: [PATCH] Fix: features/ci/admin/runners_spec.rb

---
 app/models/ci/runner.rb                    |  2 +-
 app/views/ci/admin/runners/index.html.haml |  2 +-
 app/views/ci/admin/runners/show.html.haml  |  2 +-
 spec/features/ci/admin/runners_spec.rb     | 10 ++++++----
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index 79c81df5eb2..1e9f78a3748 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -37,7 +37,7 @@ module Ci
     acts_as_taggable
 
     def self.search(query)
-      where('LOWER(runners.token) LIKE :query OR LOWER(runners.description) like :query',
+      where('LOWER(ci_runners.token) LIKE :query OR LOWER(ci_runners.description) like :query',
             query: "%#{query.try(:downcase)}%")
     end
 
diff --git a/app/views/ci/admin/runners/index.html.haml b/app/views/ci/admin/runners/index.html.haml
index d578ff922ad..b9d6703ff41 100644
--- a/app/views/ci/admin/runners/index.html.haml
+++ b/app/views/ci/admin/runners/index.html.haml
@@ -25,7 +25,7 @@
 
 .append-bottom-20.clearfix
   .pull-left
-    = form_tag ci_admin_runners_path, class: 'form-inline', method: :get do
+    = form_tag ci_admin_runners_path, id: 'runners-search', class: 'form-inline', method: :get do
       .form-group
         = search_field_tag :search, params[:search], class: 'form-control', placeholder: 'Runner description or token'
       = submit_tag 'Search', class: 'btn'
diff --git a/app/views/ci/admin/runners/show.html.haml b/app/views/ci/admin/runners/show.html.haml
index 0270da53349..24e0ad3b070 100644
--- a/app/views/ci/admin/runners/show.html.haml
+++ b/app/views/ci/admin/runners/show.html.haml
@@ -74,7 +74,7 @@
 
       %tr
         %td
-          = form_tag ci_admin_runner_path(@runner), class: 'form-inline', method: :get do
+          = form_tag ci_admin_runner_path(@runner), id: 'runner-projects-search', class: 'form-inline', method: :get do
             .form-group
               = search_field_tag :search, params[:search], class: 'form-control'
             = submit_tag 'Search', class: 'btn'
diff --git a/spec/features/ci/admin/runners_spec.rb b/spec/features/ci/admin/runners_spec.rb
index 644d48ac298..b25121f0806 100644
--- a/spec/features/ci/admin/runners_spec.rb
+++ b/spec/features/ci/admin/runners_spec.rb
@@ -23,8 +23,9 @@ describe "Admin Runners" do
         FactoryGirl.create :ci_runner, description: 'foo'
         FactoryGirl.create :ci_runner, description: 'bar'
 
-        fill_in 'search', with: 'foo'
-        click_button 'Search'
+        search_form = find('#runners-search')
+        search_form.fill_in 'search', with: 'foo'
+        search_form.click_button 'Search'
       end
 
       it { expect(page).to have_content("foo") }
@@ -52,8 +53,9 @@ describe "Admin Runners" do
 
     describe 'search' do
       before do
-        fill_in 'search', with: 'foo'
-        click_button 'Search'
+        search_form = find('#runner-projects-search')
+        search_form.fill_in 'search', with: 'foo'
+        search_form.click_button 'Search'
       end
 
       it { expect(page).to have_content("foo") }
-- 
GitLab