Specs for caching and issue controller changes
This commit is contained in:
parent
1fabeecf85
commit
968e35a692
|
@ -162,12 +162,10 @@ module IssuableActions
|
||||||
end
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
# We want to pass back the latest valid data, so reload the model
|
|
||||||
render json: {
|
render json: {
|
||||||
errors: [
|
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."
|
"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
|
}, status: :conflict
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -379,6 +379,23 @@ describe Projects::IssuesController do
|
||||||
expect(response).to have_gitlab_http_status(200)
|
expect(response).to have_gitlab_http_status(200)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
describe 'Confidential Issues' do
|
describe 'Confidential Issues' do
|
||||||
|
|
|
@ -133,6 +133,15 @@ describe CacheMarkdownField do
|
||||||
end
|
end
|
||||||
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
|
context 'a non-markdown field changed' do
|
||||||
shared_examples 'with cache version' do |cache_version|
|
shared_examples 'with cache version' do |cache_version|
|
||||||
let(:thing) { ThingWithMarkdownFields.new(foo: markdown, foo_html: html, cached_markdown_version: cache_version) }
|
let(:thing) { ThingWithMarkdownFields.new(foo: markdown, foo_html: html, cached_markdown_version: cache_version) }
|
||||||
|
|
Loading…
Reference in New Issue