Commit b2e990f4 authored by nmilojevic1's avatar nmilojevic1

Fix MR review comments

 - Add some new lines
 - Remove translation for error message
parent 8900ddf3
......@@ -26,8 +26,8 @@ class DiffNote < Note
NoteDiffFileCreationError = Class.new(StandardError)
DIFF_LINE_NOT_FOUND_MESSAGE = _("Failed to find diff line for: %{file_path}, old_line: %{old_line}, new_line: %{new_line}")
DIFF_FILE_NOT_FOUND_MESSAGE = _("Failed to find diff file")
DIFF_LINE_NOT_FOUND_MESSAGE = "Failed to find diff line for: %{file_path}, old_line: %{old_line}, new_line: %{new_line}"
DIFF_FILE_NOT_FOUND_MESSAGE = "Failed to find diff file"
after_commit :create_diff_file, on: :create
......
......@@ -7373,12 +7373,6 @@ msgstr ""
msgid "Failed to enqueue the rebase operation, possibly due to a long-lived transaction. Try again later."
msgstr ""
msgid "Failed to find diff file"
msgstr ""
msgid "Failed to find diff line for: %{file_path}, old_line: %{old_line}, new_line: %{new_line}"
msgstr ""
msgid "Failed to get ref."
msgstr ""
......
......@@ -207,6 +207,7 @@ describe DiffNote do
it 'does not create diff note file if it is a reply' do
diff_note = create(:diff_note_on_merge_request, project: project, noteable: merge_request)
expect { create(:diff_note_on_merge_request, noteable: merge_request, in_reply_to: diff_note) }
.not_to change(NoteDiffFile, :count)
end
......
......@@ -9,6 +9,7 @@ shared_examples 'a valid diff note with after commit callback' do
context 'when diff_line is not found' do
it 'raises an error' do
allow(diff_file_from_repository).to receive(:line_for_position).with(position).and_return(nil)
expect { subject.save }.to raise_error(::DiffNote::NoteDiffFileCreationError,
"Failed to find diff line for: #{diff_file_from_repository.file_path}, "\
"old_line: #{position.old_line}"\
......@@ -23,11 +24,13 @@ shared_examples 'a valid diff note with after commit callback' do
it 'fallback to fetch file from repository' do
expect_any_instance_of(::Gitlab::Diff::Position).to receive(:diff_file).with(project.repository)
subject.save
end
it 'creates a diff note file' do
subject.save
expect(subject.reload.note_diff_file).to be_present
end
end
......@@ -36,6 +39,7 @@ shared_examples 'a valid diff note with after commit callback' do
context 'when diff file is not found in repository' do
it 'raises an error' do
allow_any_instance_of(::Gitlab::Diff::Position).to receive(:diff_file).with(project.repository).and_return(nil)
expect { subject.save }.to raise_error(::DiffNote::NoteDiffFileCreationError, 'Failed to find diff file')
end
end
......
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