diff options
author | Valery Sizov <valery@gitlab.com> | 2016-11-09 09:00:44 +0200 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-11-09 09:00:44 +0200 |
commit | dbaeb02572d73085bd5175efbc20204ea520be82 (patch) | |
tree | 5e681a1f554bc3b42b131ca4ce387716ab9b1067 | |
parent | 937fe659a1f26c2f88c802ba2c01e6a7bc5b9ede (diff) | |
download | gitlab-ce-dbaeb02572d73085bd5175efbc20204ea520be82.tar.gz |
Resolve global_search_spec.rb
-rw-r--r-- | spec/features/es_global_search_spec.rb | 74 | ||||
-rw-r--r-- | spec/features/global_search_spec.rb | 50 |
2 files changed, 76 insertions, 48 deletions
diff --git a/spec/features/es_global_search_spec.rb b/spec/features/es_global_search_spec.rb new file mode 100644 index 00000000000..406d06a9a86 --- /dev/null +++ b/spec/features/es_global_search_spec.rb @@ -0,0 +1,74 @@ +require 'spec_helper' + +feature 'Global elastic search', feature: true do + let(:user) { create(:user) } + let(:project) { create(:project, namespace: user.namespace) } + + before do + stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true) + Gitlab::Elastic::Helper.create_empty_index + + project.team << [user, :master] + login_with(user) + end + + after do + Gitlab::Elastic::Helper.delete_index + stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false) + end + + describe 'I search through the issues and I see pagination' do + before do + create_list(:issue, 21, project: project, title: 'initial') + + Gitlab::Elastic::Helper.refresh_index + end + + it "has a pagination" do + visit dashboard_projects_path + + fill_in "search", with: "initial" + click_button "Go" + + select_filter("Issues") + expect(page).to have_selector('.gl-pagination .page', count: 2) + end + end + + describe 'I search through the blobs' do + before do + project.repository.index_blobs + + Gitlab::Elastic::Helper.refresh_index + end + + it "finds files" do + visit dashboard_projects_path + + fill_in "search", with: "def" + click_button "Go" + + select_filter("Code") + + expect(page).to have_selector('.file-content .code') + end + end + + describe 'I search through the commits' do + before do + project.repository.index_commits + Gitlab::Elastic::Helper.refresh_index + end + + it "finds commits" do + visit dashboard_projects_path + + fill_in "search", with: "add" + click_button "Go" + + select_filter("Commits") + + expect(page).to have_selector('.commit-row-description') + end + end +end diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb index 9469e572c7c..f6409e00f22 100644 --- a/spec/features/global_search_spec.rb +++ b/spec/features/global_search_spec.rb @@ -5,23 +5,14 @@ feature 'Global search', feature: true do let(:project) { create(:project, namespace: user.namespace) } before do - stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true) - Gitlab::Elastic::Helper.create_empty_index - project.team << [user, :master] login_with(user) end - after do - Gitlab::Elastic::Helper.delete_index - stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false) - end - describe 'I search through the issues and I see pagination' do before do - create_list(:issue, 21, project: project, title: 'initial') - - Gitlab::Elastic::Helper.refresh_index + allow_any_instance_of(Gitlab::SearchResults).to receive(:per_page).and_return(1) + create_list(:issue, 2, project: project, title: 'initial') end it "has a pagination" do @@ -34,41 +25,4 @@ feature 'Global search', feature: true do expect(page).to have_selector('.gl-pagination .page', count: 2) end end - - describe 'I search through the blobs' do - before do - project.repository.index_blobs - - Gitlab::Elastic::Helper.refresh_index - end - - it "finds files" do - visit dashboard_projects_path - - fill_in "search", with: "def" - click_button "Go" - - select_filter("Code") - - expect(page).to have_selector('.file-content .code') - end - end - - describe 'I search through the commits' do - before do - project.repository.index_commits - Gitlab::Elastic::Helper.refresh_index - end - - it "finds commits" do - visit dashboard_projects_path - - fill_in "search", with: "add" - click_button "Go" - - select_filter("Commits") - - expect(page).to have_selector('.commit-row-description') - end - end end |