Commit bf977fa5 authored by Walmyr Lima's avatar Walmyr Lima

Remove duplication from test

This is being done by:
- Creating a new context for tests that have the same pre-condition
- Creating a before block for the pre-condition so it doesn't need
to be duplicated in all the three affected tests.
parent 4e8a7892
...@@ -37,41 +37,41 @@ module QA ...@@ -37,41 +37,41 @@ module QA
let(:issue) { create_issue_resource } let(:issue) { create_issue_resource }
let(:epic) { create_epic_resource(issue.project.group) } let(:epic) { create_epic_resource(issue.project.group) }
it 'adds/removes issue to/from epic' do context 'Visit epic first' do
epic.visit! before do
epic.visit!
end
EE::Page::Group::Epic::Show.perform do |show| it 'adds/removes issue to/from epic' do
show.add_issue_to_epic(issue.web_url) EE::Page::Group::Epic::Show.perform do |show|
show.add_issue_to_epic(issue.web_url)
expect(show).to have_related_issue_item expect(show).to have_related_issue_item
show.remove_issue_from_epic show.remove_issue_from_epic
expect(show).to have_no_related_issue_item expect(show).to have_no_related_issue_item
end
end end
end
it 'comments on epic' do it 'comments on epic' do
epic.visit! comment = 'My Epic Comment'
EE::Page::Group::Epic::Show.perform do |show|
show.add_comment_to_epic(comment)
end
comment = 'My Epic Comment' expect(page).to have_content(comment)
EE::Page::Group::Epic::Show.perform do |show|
show.add_comment_to_epic(comment)
end end
expect(page).to have_content(comment) it 'closes and reopens an epic' do
end EE::Page::Group::Epic::Show.perform(&:close_reopen_epic)
it 'closes and reopens an epic' do expect(page).to have_content('Closed')
epic.visit!
EE::Page::Group::Epic::Show.perform(&:close_reopen_epic)
expect(page).to have_content('Closed') EE::Page::Group::Epic::Show.perform(&:close_reopen_epic)
EE::Page::Group::Epic::Show.perform(&:close_reopen_epic) expect(page).to have_content('Open')
end
expect(page).to have_content('Open')
end end
it 'adds/removes issue to/from epic using quick actions' do it 'adds/removes issue to/from epic using quick actions' 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