2017-03-10 01:29:11 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe DiffDiscussion, model: true do
|
2017-03-13 22:13:12 +00:00
|
|
|
subject { described_class.new([first_note, second_note, third_note]) }
|
|
|
|
|
|
|
|
let(:first_note) { create(:diff_note_on_merge_request) }
|
2017-04-04 22:27:23 +00:00
|
|
|
let(:merge_request) { first_note.noteable }
|
|
|
|
let(:project) { first_note.project }
|
|
|
|
let(:second_note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project, in_reply_to: first_note) }
|
|
|
|
let(:third_note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project, in_reply_to: first_note) }
|
2017-03-13 22:13:12 +00:00
|
|
|
|
2017-03-17 19:25:52 +00:00
|
|
|
describe '#reply_attributes' do
|
|
|
|
it 'includes position and original_position' do
|
|
|
|
attributes = subject.reply_attributes
|
|
|
|
expect(attributes[:position]).to eq(first_note.position.to_json)
|
|
|
|
expect(attributes[:original_position]).to eq(first_note.original_position.to_json)
|
|
|
|
end
|
|
|
|
end
|
2017-03-10 01:29:11 +00:00
|
|
|
end
|