Prevents position update for image diff notes

This commit is contained in:
Felipe Artur 2017-11-13 16:38:15 -02:00
parent 9200b50012
commit aefefbf117
3 changed files with 13 additions and 1 deletions

View File

@ -18,7 +18,8 @@ class DiffNote < Note
validate :positions_complete
validate :verify_supported
before_validation :set_original_position, :update_position, on: :create
before_validation :set_original_position, on: :create
before_validation :update_position, on: :create, if: :on_text?
before_validation :set_line_code
after_save :keep_around_commits

View File

@ -0,0 +1,5 @@
---
title: Prevents position update for image diff notes
merge_request:
author:
type: fixed

View File

@ -283,6 +283,12 @@ describe DiffNote do
expect(diff_line).to be nil
expect(subject).to be_valid
end
it "does not update the position" do
expect(subject).not_to receive(:update_position)
subject.save
end
end
it "returns true for on_image?" do