summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-08-25 16:03:02 +0000
committerRobert Speicher <robert@gitlab.com>2017-08-25 16:03:02 +0000
commit7edeccfc7fbfdc3898b630324d5ef46d58ffd809 (patch)
tree77a70b9604bd5a5c0d02d82e83d92f6acf528c54
parent32fa51102bfa6b6fc1f4a6b9d1a8fb3be004ad71 (diff)
parentec1ec9b67a95de3b775eefe0f4cdce6fd3aa7b70 (diff)
downloadgitlab-ce-7edeccfc7fbfdc3898b630324d5ef46d58ffd809.tar.gz
Merge branch 'replace_spinach_search_code.feature' into 'master'
Replace 'source/search_code.feature' spinach test with an rspec analog See merge request !13697
-rw-r--r--changelogs/unreleased/replace_spinach_search_code-feature.yml5
-rw-r--r--features/project/source/search_code.feature15
-rw-r--r--features/steps/project/source/search_code.rb19
-rw-r--r--features/steps/shared/paths.rb4
-rw-r--r--spec/features/projects/files/find_files_spec.rb23
-rw-r--r--spec/features/projects/files/user_searches_for_files_spec.rb58
6 files changed, 63 insertions, 61 deletions
diff --git a/changelogs/unreleased/replace_spinach_search_code-feature.yml b/changelogs/unreleased/replace_spinach_search_code-feature.yml
new file mode 100644
index 00000000000..28d2108c871
--- /dev/null
+++ b/changelogs/unreleased/replace_spinach_search_code-feature.yml
@@ -0,0 +1,5 @@
+---
+title: Replace 'source/search_code.feature' spinach test with an rspec analog
+merge_request: 13697
+author: blackst0ne
+type: other
diff --git a/features/project/source/search_code.feature b/features/project/source/search_code.feature
deleted file mode 100644
index 4f9dcea249f..00000000000
--- a/features/project/source/search_code.feature
+++ /dev/null
@@ -1,15 +0,0 @@
-Feature: Project Source Search Code
- Background:
- Given I sign in as a user
-
- 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/source/search_code.rb b/features/steps/project/source/search_code.rb
deleted file mode 100644
index feee756d7ec..00000000000
--- a/features/steps/project/source/search_code.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class Spinach::Features::ProjectSourceSearchCode < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedProject
- include SharedPaths
-
- step 'I search for term "coffee"' do
- fill_in "search", with: "coffee"
- click_button "Go"
- end
-
- step 'I should see files from repository containing "coffee"' do
- expect(page).to have_content 'coffee'
- expect(page).to have_content 'CONTRIBUTING.md'
- end
-
- step 'I should see empty result' do
- expect(page).to have_content "We couldn't find any"
- end
-end
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 830263fd038..be69a96c3ee 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -304,10 +304,6 @@ module SharedPaths
visit project_commits_path(@project, 'stable', { limit: 5 })
end
- step 'I visit project source page' do
- visit project_tree_path(@project, root_ref)
- end
-
step 'I visit blob file from repo' do
visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
end
diff --git a/spec/features/projects/files/find_files_spec.rb b/spec/features/projects/files/find_files_spec.rb
deleted file mode 100644
index 57d67b28920..00000000000
--- a/spec/features/projects/files/find_files_spec.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'spec_helper'
-
-feature 'Find files button in the tree header' do
- given(:user) { create(:user) }
- given(:project) { create(:project, :repository) }
-
- background do
- sign_in(user)
- project.team << [user, :developer]
- end
-
- scenario 'project main screen' do
- visit project_path(project)
-
- expect(page).to have_selector('.tree-controls .shortcuts-find-file')
- end
-
- scenario 'project tree screen' do
- visit project_tree_path(project, project.default_branch)
-
- expect(page).to have_selector('.tree-controls .shortcuts-find-file')
- end
-end
diff --git a/spec/features/projects/files/user_searches_for_files_spec.rb b/spec/features/projects/files/user_searches_for_files_spec.rb
new file mode 100644
index 00000000000..a105685bca7
--- /dev/null
+++ b/spec/features/projects/files/user_searches_for_files_spec.rb
@@ -0,0 +1,58 @@
+require 'spec_helper'
+
+describe 'User searches for files' do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :repository) }
+
+ before do
+ sign_in(user)
+ end
+
+ describe 'project main screen' do
+ context 'when project is empty' do
+ let(:empty_project) { create(:project) }
+
+ before do
+ empty_project.add_developer(user)
+ visit project_path(empty_project)
+ end
+
+ it 'does not show any result' do
+ fill_in('search', with: 'coffee')
+ click_button('Go')
+
+ expect(page).to have_content("We couldn't find any")
+ end
+ end
+
+ context 'when project is not empty' do
+ before do
+ project.add_developer(user)
+ visit project_path(project)
+ end
+
+ it 'shows "Find file" button' do
+ expect(page).to have_selector('.tree-controls .shortcuts-find-file')
+ end
+ end
+ end
+
+ describe 'project tree screen' do
+ before do
+ project.add_developer(user)
+ visit project_tree_path(project, project.default_branch)
+ end
+
+ it 'shows "Find file" button' do
+ expect(page).to have_selector('.tree-controls .shortcuts-find-file')
+ end
+
+ it 'shows found files' do
+ fill_in('search', with: 'coffee')
+ click_button('Go')
+
+ expect(page).to have_content('coffee')
+ expect(page).to have_content('CONTRIBUTING.md')
+ end
+ end
+end