diff options
author | Andrew Fontaine <afontaine@gitlab.com> | 2019-01-18 01:31:05 +0300 |
---|---|---|
committer | Andrew Fontaine <afontaine@gitlab.com> | 2019-01-25 22:59:41 +0300 |
commit | 01a713d64c69fb1b1785c614a336f20ad911bbef (patch) | |
tree | ef7b9abec21704ff3898e0c241cd47cfd6728dfa /spec/views | |
parent | 2b8f19435bd81b24f512236245445109c14a2297 (diff) |
Indicate on Status if Issue was Moved
Add the text `(moved)` to the `Closed` status indicator on a closed
issue if the reason the issue was closed was due to moving it.
This only applies to closed issues. Issues that were closed and moved
then later re-opened only show `Open`. This makes it more immidately
clear why the issue was closed.
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/issues/show.html.haml_spec.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/views/projects/issues/show.html.haml_spec.rb b/spec/views/projects/issues/show.html.haml_spec.rb new file mode 100644 index 00000000000..ff88efd0e31 --- /dev/null +++ b/spec/views/projects/issues/show.html.haml_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'projects/issues/show' do + let(:project) { create(:project, :repository) } + let(:issue) { create(:issue, project: project, author: user) } + let(:user) { create(:user) } + + before do + assign(:project, project) + assign(:issue, issue) + assign(:noteable, issue) + stub_template 'shared/issuable/_sidebar' => '' + stub_template 'projects/issues/_discussion' => '' + allow(view).to receive(:issuable_meta).and_return('') + end + + context 'when the issue is closed' do + before do + allow(issue).to receive(:closed?).and_return(true) + end + + it 'shows "Closed (moved)" if an issue has been moved' do + allow(issue).to receive(:moved?).and_return(true) + + render + + expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)') + end + + it 'shows "Closed" if an issue has not been moved' do + render + + expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed') + end + end + + context 'when the issue is open' do + before do + allow(issue).to receive(:closed?).and_return(false) + allow(issue).to receive(:disscussion_locked).and_return(false) + end + + it 'shows "Open" if an issue has been moved' do + render + + expect(rendered).to have_selector('.status-box-open:not(.hidden)', text: 'Open') + end + end +end |