Commit 42d2f3f8 authored by nmilojevic1's avatar nmilojevic1

Fix specs based on MR comments

  Replaced allow_any_instance with allow_next_instance
  Extracted line_code and fixed spacing
parent 4fcea9e3
...@@ -117,8 +117,10 @@ describe DiffNote do ...@@ -117,8 +117,10 @@ describe DiffNote do
let(:diff_line) { diff_file.diff_lines.first } let(:diff_line) { diff_file.diff_lines.first }
let(:line_code) { '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14' }
before do before do
allow_any_instance_of(::Gitlab::Diff::Position).to receive(:line_code).with(project.repository).and_return('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14') allow(subject.position).to receive(:line_code).and_return('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14')
end end
context 'when diffs are already created' do context 'when diffs are already created' do
...@@ -134,7 +136,7 @@ describe DiffNote do ...@@ -134,7 +136,7 @@ describe DiffNote do
context 'when importing' do context 'when importing' do
before do before do
subject.importing = true subject.importing = true
subject.line_code = '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14' subject.line_code = line_code
end end
context 'when diff_line is found in persisted diff_file' do context 'when diff_line is found in persisted diff_file' do
...@@ -186,7 +188,9 @@ describe DiffNote do ...@@ -186,7 +188,9 @@ describe DiffNote do
context 'when diff file is not found in persisted diffs' do context 'when diff file is not found in persisted diffs' do
before do before do
allow_any_instance_of(::Gitlab::Diff::FileCollection::MergeRequestDiff).to receive(:diff_files).and_return([]) allow_next_instance_of(Gitlab::Diff::FileCollection::MergeRequestDiff) do |merge_request_diff|
allow(merge_request_diff).to receive(:diff_files).and_return([])
end
end end
it_behaves_like 'a valid diff note with after commit callback' it_behaves_like 'a valid diff note with after commit callback'
......
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