diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 9fd477dcdb..91a6798571 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -34,6 +34,7 @@ class DashboardController < ApplicationController @projects end + @projects = @projects.search(params[:search]) if params[:search].present? @projects = @projects.page(params[:page]).per(30) end diff --git a/app/views/dashboard/_filter.html.haml b/app/views/dashboard/_filter.html.haml index 82e679d592..df4447cd20 100644 --- a/app/views/dashboard/_filter.html.haml +++ b/app/views/dashboard/_filter.html.haml @@ -1,6 +1,6 @@ = form_tag dashboard_filter_path(entity), method: 'get' do %fieldset.dashboard-search-filter - = search_field_tag "search", params[:search], { placeholder: 'Search', class: 'search-text-input' } + = search_field_tag "search", params[:search], { id: 'filter_search', placeholder: 'Search', class: 'search-text-input' } = button_tag type: 'submit', class: 'btn' do %i.icon-search diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml index 8e21b0c7e0..e211fc34d1 100644 --- a/app/views/dashboard/projects.html.haml +++ b/app/views/dashboard/projects.html.haml @@ -24,7 +24,7 @@ = form_tag projects_dashboard_path, method: 'get' do %fieldset.dashboard-search-filter = hidden_field_tag "scope", params[:scope] - = search_field_tag "search", params[:search], { placeholder: 'Search', class: 'left input-xxlarge' } + = search_field_tag "search", params[:search], { id: 'dashboard_projects_search', placeholder: 'Search', class: 'left input-xxlarge'} = button_tag type: 'submit', class: 'btn' do %i.icon-search diff --git a/features/dashboard/projects.feature b/features/dashboard/projects.feature index 17022dab54..7e617bd1bf 100644 --- a/features/dashboard/projects.feature +++ b/features/dashboard/projects.feature @@ -1,8 +1,12 @@ -Feature: Dashboard +Feature: Dashboard projects Background: Given I sign in as a user And I own project "Shop" And I visit dashboard projects page - Scenario: I should see issues list + Scenario: I should see projects list Then I should see projects list + + Scenario: I should see project I am looking for + Given I search for "Sho" + Then I should see "Shop" project link diff --git a/features/steps/dashboard/dashboard_projects.rb b/features/steps/dashboard/dashboard_projects.rb new file mode 100644 index 0000000000..de471ebd8c --- /dev/null +++ b/features/steps/dashboard/dashboard_projects.rb @@ -0,0 +1,23 @@ +class Dashboard < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Then 'I should see projects list' do + @user.authorized_projects.all.each do |project| + page.should have_link project.name_with_namespace + end + end + + Given 'I search for "Sho"' do + fill_in "dashboard_projects_search", with: "Sho" + + within ".dashboard-search-filter" do + find('button').click + end + end + + Then 'I should see "Shop" project link' do + page.should have_link "Shop" + end +end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 5e61a4132c..81863a54f3 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -9,7 +9,8 @@ module SharedProject # Create a specific project called "Shop" And 'I own project "Shop"' do - @project = create(:project, name: "Shop") + @project = Project.find_by_name "Shop" + @project ||= create(:project, name: "Shop") @project.team << [@user, :master] end