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

27 lines
602 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
FactoryBot.define do
factory :suggestion do
2019-12-21 20:55:43 +05:30
relative_order { 0 }
2019-02-15 15:39:39 +05:30
association :note, factory: :diff_note_on_merge_request
2019-12-21 20:55:43 +05:30
from_content { " vars = {\n" }
to_content { " vars = [\n" }
2019-02-15 15:39:39 +05:30
trait :unappliable do
2019-12-21 20:55:43 +05:30
from_content { "foo" }
to_content { "foo" }
2019-02-15 15:39:39 +05:30
end
trait :applied do
2019-12-21 20:55:43 +05:30
applied { true }
2019-02-15 15:39:39 +05:30
commit_id { RepoHelpers.sample_commit.id }
end
2019-07-07 11:18:12 +05:30
trait :content_from_repo do
after(:build) do |suggestion, evaluator|
suggestion.from_content = suggestion.fetch_from_content
end
end
2019-02-15 15:39:39 +05:30
end
end