Commit c3f93385 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

DRY up tests

parent 8f016690
...@@ -8,6 +8,17 @@ describe 'Issues' do ...@@ -8,6 +8,17 @@ describe 'Issues' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } 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 'while user is signed out' do
describe 'empty state' do describe 'empty state' do
it 'user sees empty state' do it 'user sees empty state' do
...@@ -18,14 +29,7 @@ describe 'Issues' 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.') expect(page).to have_content('You can register or sign in to create issues for this project.')
end end
it 'user sees empty state with filters' do it_behaves_like 'empty state with filters'
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 end
end end
...@@ -47,14 +51,7 @@ describe 'Issues' do ...@@ -47,14 +51,7 @@ describe 'Issues' do
expect(page).to have_content('New issue') expect(page).to have_content('New issue')
end end
it 'user sees empty state with filters' do it_behaves_like 'empty state with filters'
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 end
describe 'Edit issue' do describe 'Edit issue' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment