summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-11 12:41:58 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-11 12:41:58 +0300
commitbdb9340e4d0fc0badb5202a5c910be8cdf2ba180 (patch)
tree62f3f7fd49fd4ee58e2c0d711fbed2c3fb95f6a2 /features
parent7122a823f859a1201428791e32000c4a8bcc6787 (diff)
parentf361be9eca790c444c9a95c98fe8e5f95e1d7f95 (diff)
downloadgitlab-ce-bdb9340e4d0fc0badb5202a5c910be8cdf2ba180.tar.gz
Merge pull request #7385 from Razer6/fix_search_empty_project
Fix 500 on searching on empty project, restyle search page
Diffstat (limited to 'features')
-rw-r--r--features/project/source/search_code.feature10
-rw-r--r--features/steps/project/search_code.rb12
-rw-r--r--features/steps/shared/project.rb7
3 files changed, 23 insertions, 6 deletions
diff --git a/features/project/source/search_code.feature b/features/project/source/search_code.feature
index ad8a650d895..93b326696d0 100644
--- a/features/project/source/search_code.feature
+++ b/features/project/source/search_code.feature
@@ -1,9 +1,15 @@
Feature: Project Search code
Background:
Given I sign in as a user
- And I own project "Shop"
- Given I visit project source page
Scenario: Search for term "coffee"
+ Given I own project "Shop"
+ And I visit project source page
When I search for term "coffee"
Then I should see files from repository containing "coffee"
+
+ Scenario: Search on empty project
+ Given I own an empty project
+ And I visit my project's home page
+ When I search for term "coffee"
+ Then I should see empty result
diff --git a/features/steps/project/search_code.rb b/features/steps/project/search_code.rb
index 8d130a8ed0d..affa7d3b43b 100644
--- a/features/steps/project/search_code.rb
+++ b/features/steps/project/search_code.rb
@@ -3,14 +3,18 @@ class ProjectSearchCode < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- When 'I search for term "coffee"' do
+ step 'I search for term "coffee"' do
fill_in "search", with: "coffee"
click_button "Go"
click_link 'Repository Code'
end
- Then 'I should see files from repository containing "coffee"' do
- page.should have_content "coffee"
- page.should have_content " CONTRIBUTING.md"
+ step 'I should see files from repository containing "coffee"' do
+ page.should have_content 'coffee'
+ page.should have_content 'CONTRIBUTING.md'
+ end
+
+ step 'I should see empty result' do
+ page.should have_content "We couldn't find any matching code"
end
end
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index 655840f447d..c131976614f 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -21,6 +21,13 @@ module SharedProject
@project.team << [@user, :master]
end
+ # Create an empty project without caring about the name
+ And 'I own an empty project' do
+ @project = create(:empty_project,
+ name: 'Empty Project', namespace: @user.namespace)
+ @project.team << [@user, :master]
+ end
+
And 'project "Shop" has push event' do
@project = Project.find_by(name: "Shop")