diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-01-05 20:34:53 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-01-05 20:34:53 +0000 |
commit | 32b1ceb03677a7484bf10412fbe67ad94b57d51c (patch) | |
tree | cde572b629a34642f9dbb05057fd5e879205d94f /spec | |
parent | 4a1a06f4c6a9fe21504258ac3c1b007853bfd98b (diff) | |
parent | 6e7e5052374d67c0b3ed6cac3f62a29778d10858 (diff) | |
download | gitlab-ce-32b1ceb03677a7484bf10412fbe67ad94b57d51c.tar.gz |
Merge branch '26155-merge-request-tabs-don-t-render-when-no-commits-available' into 'master'
Resolve "Merge request tabs don't render when no commits available"
Closes #26155 and #24556
See merge request !8347
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/merge_requests/deleted_source_branch_spec.rb | 19 | ||||
-rw-r--r-- | spec/views/projects/merge_requests/show.html.haml_spec.rb | 7 |
2 files changed, 20 insertions, 6 deletions
diff --git a/spec/features/merge_requests/deleted_source_branch_spec.rb b/spec/features/merge_requests/deleted_source_branch_spec.rb index d5c9ed8a3b7..0952b17b63e 100644 --- a/spec/features/merge_requests/deleted_source_branch_spec.rb +++ b/spec/features/merge_requests/deleted_source_branch_spec.rb @@ -4,6 +4,8 @@ require 'spec_helper' # message to be shown by JavaScript when the source branch was deleted. # Please do not remove "js: true". describe 'Deleted source branch', feature: true, js: true do + include WaitForAjax + let(:user) { create(:user) } let(:merge_request) { create(:merge_request) } @@ -13,7 +15,8 @@ describe 'Deleted source branch', feature: true, js: true do merge_request.update!(source_branch: 'this-branch-does-not-exist') visit namespace_project_merge_request_path( merge_request.project.namespace, - merge_request.project, merge_request + merge_request.project, + merge_request ) end @@ -23,11 +26,17 @@ describe 'Deleted source branch', feature: true, js: true do ) end - it 'hides Discussion, Commits and Changes tabs' do + it 'still contains Discussion, Commits and Changes tabs' do within '.merge-request-details' do - expect(page).to have_no_content('Discussion') - expect(page).to have_no_content('Commits') - expect(page).to have_no_content('Changes') + expect(page).to have_content('Discussion') + expect(page).to have_content('Commits') + expect(page).to have_content('Changes') end + + click_on 'Changes' + wait_for_ajax + + expect(page).to have_selector('.diffs.tab-pane .nothing-here-block') + expect(page).to have_content('Nothing to merge from this-branch-does-not-exist into feature') end end diff --git a/spec/views/projects/merge_requests/show.html.haml_spec.rb b/spec/views/projects/merge_requests/show.html.haml_spec.rb index 33cabd14913..7f123b15194 100644 --- a/spec/views/projects/merge_requests/show.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb @@ -7,6 +7,7 @@ describe 'projects/merge_requests/show.html.haml' do let(:project) { create(:project) } let(:fork_project) { create(:project, forked_from_project: project) } let(:unlink_project) { Projects::UnlinkForkService.new(fork_project, user) } + let(:note) { create(:note_on_merge_request, project: project, noteable: closed_merge_request) } let(:closed_merge_request) do create(:closed_merge_request, @@ -19,8 +20,12 @@ describe 'projects/merge_requests/show.html.haml' do assign(:project, project) assign(:merge_request, closed_merge_request) assign(:commits_count, 0) + assign(:note, note) + assign(:noteable, closed_merge_request) + assign(:notes, []) + assign(:pipelines, Ci::Pipeline.none) - allow(view).to receive(:can?).and_return(true) + allow(view).to receive_messages(current_user: user, can?: true) end context 'when the merge request is closed' do |