diff options
author | Brett Walker <bwalker@gitlab.com> | 2019-01-23 15:58:46 -0600 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-01-30 23:18:17 +0100 |
commit | 968e35a692b94ad0fe3bc8be03f64b5e8fec30c0 (patch) | |
tree | 3e65dbd0519f8a220ce368f94b4079fefb13e41b | |
parent | 1fabeecf85cc637fd68ca99a4de7bf3cb3b915bc (diff) | |
download | gitlab-ce-968e35a692b94ad0fe3bc8be03f64b5e8fec30c0.tar.gz |
Specs for caching and issue controller changes
-rw-r--r-- | app/controllers/concerns/issuable_actions.rb | 4 | ||||
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 17 | ||||
-rw-r--r-- | spec/models/concerns/cache_markdown_field_spec.rb | 9 |
3 files changed, 27 insertions, 3 deletions
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index 1c55cd340ec..8ef3b6502df 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -162,12 +162,10 @@ module IssuableActions end format.json do - # We want to pass back the latest valid data, so reload the model render json: { errors: [ "Someone edited this #{issuable.human_class_name} at the same time you did. Please refresh your browser and make sure your changes will not unintentionally remove theirs." - ], - data: serializer.represent(@issuable.reload) # rubocop:disable Gitlab/ModuleWithInstanceVariables + ] }, status: :conflict end end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index c2afff6b732..26c88382acc 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -379,6 +379,23 @@ describe Projects::IssuesController do expect(response).to have_gitlab_http_status(200) end end + + context 'when getting the changes' do + before do + project.add_developer(user) + + sign_in(user) + end + + it 'returns the necessary data' do + go(id: issue.iid) + + data = JSON.parse(response.body) + + expect(data).to include('title_text', 'description', 'description_text') + expect(data).to include('task_status', 'lock_version') + end + end end describe 'Confidential Issues' do diff --git a/spec/models/concerns/cache_markdown_field_spec.rb b/spec/models/concerns/cache_markdown_field_spec.rb index ef6af232999..a8a5521a5fc 100644 --- a/spec/models/concerns/cache_markdown_field_spec.rb +++ b/spec/models/concerns/cache_markdown_field_spec.rb @@ -133,6 +133,15 @@ describe CacheMarkdownField do end end + context 'when a markdown field and html field are both set' do + it do + expect(thing).not_to receive(:refresh_markdown_cache) + thing.foo = '_look over there!_' + thing.foo_html = '<em>look over there!</em>' + thing.save + end + end + context 'a non-markdown field changed' do shared_examples 'with cache version' do |cache_version| let(:thing) { ThingWithMarkdownFields.new(foo: markdown, foo_html: html, cached_markdown_version: cache_version) } |