debian-mirror-gitlab/spec/factories/merge_request_diffs.rb

28 lines
857 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
FactoryBot.define do
factory :merge_request_diff do
2020-11-24 15:15:51 +05:30
merge_request do
build(:merge_request) do |merge_request|
# MergeRequest should not create a MergeRequestDiff in the callback
allow(merge_request).to receive(:ensure_merge_request_diff)
end
end
2019-12-21 20:55:43 +05:30
state { :collected }
commits_count { 1 }
2018-12-13 13:39:08 +05:30
base_commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
head_commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
start_commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
2020-11-24 15:15:51 +05:30
trait :external do
external_diff { fixture_file_upload("spec/fixtures/doc_sample.txt", "plain/txt") }
stored_externally { true }
importing { true } # this avoids setting the state to 'empty'
end
factory :external_merge_request_diff, traits: [:external]
2018-12-13 13:39:08 +05:30
end
end