Commit 968e35a6 authored by Brett Walker's avatar Brett Walker Committed by Fatih Acet

Specs for caching and issue controller changes

parent 1fabeecf
......@@ -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
......
......@@ -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
......
......@@ -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) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment