diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2018-06-21 15:22:40 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-06-21 15:22:40 +0300 |
commit | 3e66795ef1ff1228906239763910b051d8afcc37 (patch) | |
tree | df6424d9ec008f5d1da455f8465681b371c4a11e /spec/features/issues | |
parent | 14e35ac9b19d358d84e0cfd167f74036937285b6 (diff) |
Changes tab VUE refactoring
Diffstat (limited to 'spec/features/issues')
-rw-r--r-- | spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb | 22 |
2 files changed, 23 insertions, 13 deletions
diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index e0466aaf422..52962002c33 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -6,6 +6,12 @@ feature 'Resolving all open discussions in a merge request from an issue', :js d let(:merge_request) { create(:merge_request, source_project: project) } let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion } + def resolve_all_discussions_link_selector + text = "Resolve all discussions in new issue" + url = new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) + %Q{a[data-original-title="#{text}"][href="#{url}"]} + end + describe 'as a user with access to the project' do before do project.add_master(user) @@ -14,8 +20,8 @@ feature 'Resolving all open discussions in a merge request from an issue', :js d end it 'shows a button to resolve all discussions by creating a new issue' do - within('#resolve-count-app') do - expect(page).to have_link "Resolve all discussions in new issue", href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) + within('.line-resolve-all-container') do + expect(page).to have_selector resolve_all_discussions_link_selector end end @@ -25,13 +31,13 @@ feature 'Resolving all open discussions in a merge request from an issue', :js d end it 'hides the link for creating a new issue' do - expect(page).not_to have_link "Resolve all discussions in new issue", href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) + expect(page).not_to have_selector resolve_all_discussions_link_selector end end context 'creating an issue for discussions' do before do - click_link "Resolve all discussions in new issue", href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) + find(resolve_all_discussions_link_selector).click end it_behaves_like 'creating an issue for a discussion' diff --git a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb index 34beb282bad..9170f9295f0 100644 --- a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb @@ -1,11 +1,17 @@ require 'rails_helper' -feature 'Resolve an open discussion in a merge request by creating an issue' do +feature 'Resolve an open discussion in a merge request by creating an issue', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository, only_allow_merge_if_all_discussions_are_resolved: true) } let(:merge_request) { create(:merge_request, source_project: project) } let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion } + def resolve_discussion_selector + title = 'Resolve this discussion in a new issue' + url = new_project_issue_path(project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) + "a[data-original-title=\"#{title}\"][href=\"#{url}\"]" + end + describe 'As a user with access to the project' do before do project.add_master(user) @@ -20,17 +26,17 @@ feature 'Resolve an open discussion in a merge request by creating an issue' do end it 'does not show a link to create a new issue' do - expect(page).not_to have_link 'Resolve this discussion in a new issue' + expect(page).not_to have_css resolve_discussion_selector end end - context 'resolving the discussion', :js do + context 'resolving the discussion' do before do click_button 'Resolve discussion' end it 'hides the link for creating a new issue' do - expect(page).not_to have_link 'Resolve this discussion in a new issue' + expect(page).not_to have_css resolve_discussion_selector end it 'shows the link for creating a new issue when unresolving a discussion' do @@ -38,19 +44,17 @@ feature 'Resolve an open discussion in a merge request by creating an issue' do click_button 'Unresolve discussion' end - expect(page).to have_link 'Resolve this discussion in a new issue' + expect(page).to have_css resolve_discussion_selector end end it 'has a link to create a new issue for a discussion' do - new_issue_link = new_project_issue_path(project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) - - expect(page).to have_link 'Resolve this discussion in a new issue', href: new_issue_link + expect(page).to have_css resolve_discussion_selector end context 'creating the issue' do before do - click_link 'Resolve this discussion in a new issue', href: new_project_issue_path(project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) + find(resolve_discussion_selector).click end it 'has a hidden field for the discussion' do |