diff options
author | Robert Speicher <robert@gitlab.com> | 2018-01-19 02:05:28 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-01-19 02:05:28 +0300 |
commit | def2f1299512ce43370aa5b727a3d7f4733adf96 (patch) | |
tree | efa7c5b8090a3b7adbeb94834436232d251a3bf9 /spec/controllers/projects | |
parent | 561374ac12ba53acb30ee8caa1b9ff1c2e00ead6 (diff) | |
parent | 4b6b8eccedb49014d4cd329a336015fb8d7bcff9 (diff) |
Merge branch '41247-timestamp' into 'master'
Use last_edited_at instead of updated_at for displaying issuable last change
Closes #41247
See merge request gitlab-org/gitlab-ce!16406
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 66 |
1 files changed, 47 insertions, 19 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 6b7db947216..4a2998b4ccd 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -301,6 +301,53 @@ describe Projects::IssuesController do end end + describe 'GET #realtime_changes' do + def go(id:) + get :realtime_changes, + namespace_id: project.namespace.to_param, + project_id: project, + id: id + end + + context 'when an issue was edited' do + before do + project.add_developer(user) + + issue.update!(last_edited_by: user, last_edited_at: issue.created_at + 1.minute) + + sign_in(user) + end + + it 'returns last edited time' do + go(id: issue.iid) + + data = JSON.parse(response.body) + + expect(data).to include('updated_at') + expect(data['updated_at']).to eq(issue.last_edited_at.to_time.iso8601) + end + end + + context 'when an issue was edited by a deleted user' do + let(:deleted_user) { create(:user) } + + before do + project.add_developer(user) + + issue.update!(last_edited_by: deleted_user, last_edited_at: Time.now) + + deleted_user.destroy + sign_in(user) + end + + it 'returns 200' do + go(id: issue.iid) + + expect(response).to have_gitlab_http_status(200) + end + end + end + describe 'Confidential Issues' do let(:project) { create(:project_empty_repo, :public) } let(:assignee) { create(:assignee) } @@ -589,25 +636,6 @@ describe Projects::IssuesController do project_id: project, id: id end - - context 'when an issue was edited by a deleted user' do - let(:deleted_user) { create(:user) } - - before do - project.add_developer(user) - - issue.update!(last_edited_by: deleted_user, last_edited_at: Time.now) - - deleted_user.destroy - sign_in(user) - end - - it 'returns 200' do - go(id: issue.iid) - - expect(response).to have_gitlab_http_status(200) - end - end end describe 'GET #edit' do |