Add image_diff_note_on_merge_request factory
This commit is contained in:
parent
f7ac8041f7
commit
f6dd6e566a
2 changed files with 16 additions and 16 deletions
|
@ -64,6 +64,21 @@ FactoryBot.define do
|
|||
resolved_at { Time.now }
|
||||
resolved_by { create(:user) }
|
||||
end
|
||||
|
||||
factory :image_diff_note_on_merge_request do
|
||||
position do
|
||||
Gitlab::Diff::Position.new(
|
||||
old_path: "files/images/any_image.png",
|
||||
new_path: "files/images/any_image.png",
|
||||
width: 10,
|
||||
height: 10,
|
||||
x: 1,
|
||||
y: 1,
|
||||
diff_refs: diff_refs,
|
||||
position_type: "image"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
factory :diff_note_on_commit, traits: [:on_commit], class: DiffNote do
|
||||
|
|
|
@ -337,24 +337,9 @@ describe DiffNote do
|
|||
end
|
||||
|
||||
describe "image diff notes" do
|
||||
let(:path) { "files/images/any_image.png" }
|
||||
|
||||
let!(:position) do
|
||||
Gitlab::Diff::Position.new(
|
||||
old_path: path,
|
||||
new_path: path,
|
||||
width: 10,
|
||||
height: 10,
|
||||
x: 1,
|
||||
y: 1,
|
||||
diff_refs: merge_request.diff_refs,
|
||||
position_type: "image"
|
||||
)
|
||||
end
|
||||
subject { build(:image_diff_note_on_merge_request, project: project, noteable: merge_request) }
|
||||
|
||||
describe "validations" do
|
||||
subject { build(:diff_note_on_merge_request, project: project, position: position, noteable: merge_request) }
|
||||
|
||||
it { is_expected.not_to validate_presence_of(:line_code) }
|
||||
|
||||
it "does not validate diff line" do
|
||||
|
|
Loading…
Reference in a new issue