diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-08 18:12:49 +0800 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-19 23:58:35 +0800 |
commit | c3f933856d1f82e0ec8ab2eab2c1b90ad12364e2 (patch) | |
tree | 6769371f019b790416fb2f6d4578a427f30c2367 | |
parent | 8f01669016215ce736e2836b9c684bb28c2afca6 (diff) | |
download | gitlab-ce-c3f933856d1f82e0ec8ab2eab2c1b90ad12364e2.tar.gz |
DRY up tests
-rw-r--r-- | spec/features/issues_spec.rb | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index adc0ee15c59..91290858e10 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -8,6 +8,17 @@ describe 'Issues' do let(:user) { create(:user) } let(:project) { create(:project, :public) } + shared_examples_for 'empty state with filters' do + it 'user sees empty state with filters' do + create(:issue, author: user, project: project) + + visit project_issues_path(project, milestone_title: "1.0") + + expect(page).to have_content('Sorry, your filter produced no results') + expect(page).to have_content('To widen your search, change or remove filters in the filter bar above') + end + end + describe 'while user is signed out' do describe 'empty state' do it 'user sees empty state' do @@ -18,14 +29,7 @@ describe 'Issues' do expect(page).to have_content('You can register or sign in to create issues for this project.') end - it 'user sees empty state with filters' do - create(:issue, author: user, project: project) - - visit project_issues_path(project, milestone_title: "1.0") - - expect(page).to have_content('Sorry, your filter produced no results') - expect(page).to have_content('To widen your search, change or remove filters in the filter bar above') - end + it_behaves_like 'empty state with filters' end end @@ -47,14 +51,7 @@ describe 'Issues' do expect(page).to have_content('New issue') end - it 'user sees empty state with filters' do - create(:issue, author: user, project: project) - - visit project_issues_path(project, milestone_title: "1.0") - - expect(page).to have_content('Sorry, your filter produced no results') - expect(page).to have_content('To widen your search, change or remove filters in the filter bar above') - end + it_behaves_like 'empty state with filters' end describe 'Edit issue' do |