diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-30 20:36:37 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-07-31 12:46:37 +0300 |
commit | f128cdb8962e3a92ec9cb956c3aa674d7dc10ba5 (patch) | |
tree | 8b7c6551cf4ed14361c1e7edbeba8cb7ca1c9245 /spec/features | |
parent | 300f6aba4620a8c1f819786d56f50486276c0746 (diff) |
Add more specs to labels search feature
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/labels/search_labels_spec.rb | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/spec/features/projects/labels/search_labels_spec.rb b/spec/features/projects/labels/search_labels_spec.rb index dc15729190d..affd4cb9469 100644 --- a/spec/features/projects/labels/search_labels_spec.rb +++ b/spec/features/projects/labels/search_labels_spec.rb @@ -9,11 +9,11 @@ describe 'Search for labels', :js do before do project.add_maintainer(user) sign_in(user) - end - it 'searches for label by title' do visit project_labels_path(project) + end + it 'searches for label by title' do fill_in 'label-search', with: 'Bar' find('#label-search').native.send_keys(:enter) @@ -24,8 +24,6 @@ describe 'Search for labels', :js do end it 'searches for label by title' do - visit project_labels_path(project) - fill_in 'label-search', with: 'Lorem' find('#label-search').native.send_keys(:enter) @@ -34,4 +32,47 @@ describe 'Search for labels', :js do expect(page).not_to have_content(label2.title) expect(page).not_to have_content(label2.description) end + + it 'shows nothing found message' do + fill_in 'label-search', with: 'nonexistent' + find('#label-search').native.send_keys(:enter) + + expect(page).to have_content('No labels with such name or description') + expect(page).not_to have_content(label1.title) + expect(page).not_to have_content(label1.description) + expect(page).not_to have_content(label2.title) + expect(page).not_to have_content(label2.description) + end + + context 'priority labels' do + let!(:label_priority) { create(:label_priority, label: label1, project: project) } + + it 'searches for priority label' do + fill_in 'label-search', with: 'Foo' + find('#label-search').native.send_keys(:enter) + + page.within('.prioritized-labels') do + expect(page).to have_content(label1.title) + expect(page).to have_content(label1.description) + end + + page.within('.other-labels') do + expect(page).to have_content('No labels with such name or description') + end + end + + it 'searches for other label' do + fill_in 'label-search', with: 'Bar' + find('#label-search').native.send_keys(:enter) + + page.within('.prioritized-labels') do + expect(page).to have_content('No labels with such name or description') + end + + page.within('.other-labels') do + expect(page).to have_content(label2.title) + expect(page).to have_content(label2.description) + end + end + end end |