From fce22dfa2fe8dd0f551f0a24dae4a52d4096c6f1 Mon Sep 17 00:00:00 2001 From: Andrew8xx8 Date: Tue, 12 Mar 2013 15:15:14 +0400 Subject: [PATCH] Tests for dashboard projects fixed --- features/dashboard/projects.feature | 8 +++----- features/steps/dashboard/dashboard_projects.rb | 5 ++++- features/steps/shared/project.rb | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/features/dashboard/projects.feature b/features/dashboard/projects.feature index 85225271..7e617bd1 100644 --- a/features/dashboard/projects.feature +++ b/features/dashboard/projects.feature @@ -1,4 +1,4 @@ -Feature: Dashboard +Feature: Dashboard projects Background: Given I sign in as a user And I own project "Shop" @@ -8,7 +8,5 @@ Feature: Dashboard 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 - - + 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 index 9b9d4a53..de471ebd 100644 --- a/features/steps/dashboard/dashboard_projects.rb +++ b/features/steps/dashboard/dashboard_projects.rb @@ -11,7 +11,10 @@ class Dashboard < Spinach::FeatureSteps Given 'I search for "Sho"' do fill_in "dashboard_projects_search", with: "Sho" - click_button "Search" + + within ".dashboard-search-filter" do + find('button').click + end end Then 'I should see "Shop" project link' do diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 5e61a413..81863a54 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