2018-10-25 09:44:58 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :merge_request_diff do
|
2020-09-28 14:09:40 -04:00
|
|
|
association :merge_request, factory: :merge_request_without_merge_request_diff
|
2019-10-01 20:06:26 -04:00
|
|
|
state { :collected }
|
|
|
|
commits_count { 1 }
|
2018-10-25 09:44:58 -04:00
|
|
|
|
|
|
|
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-09-09 14:08:48 -04:00
|
|
|
|
2021-01-27 13:09:08 -05:00
|
|
|
diff_type { :regular }
|
|
|
|
|
2020-09-09 14:08:48 -04:00
|
|
|
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
|
|
|
|
|
2021-01-27 13:09:08 -05:00
|
|
|
trait :merge_head do
|
|
|
|
diff_type { :merge_head }
|
|
|
|
end
|
|
|
|
|
2020-09-09 14:08:48 -04:00
|
|
|
factory :external_merge_request_diff, traits: [:external]
|
2018-10-25 09:44:58 -04:00
|
|
|
end
|
|
|
|
end
|