2016-04-13 05:25:42 -04:00
|
|
|
require_relative '../support/repo_helpers'
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-04-13 05:25:42 -04:00
|
|
|
factory :commit do
|
2017-11-18 09:06:55 -05:00
|
|
|
transient do
|
|
|
|
author nil
|
|
|
|
end
|
|
|
|
|
|
|
|
git_commit do
|
|
|
|
commit = RepoHelpers.sample_commit
|
|
|
|
|
|
|
|
if author
|
|
|
|
commit.author_email = author.email
|
|
|
|
commit.author_name = author.name
|
|
|
|
end
|
|
|
|
|
|
|
|
commit
|
|
|
|
end
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2016-04-13 05:25:42 -04:00
|
|
|
|
|
|
|
initialize_with do
|
|
|
|
new(git_commit, project)
|
|
|
|
end
|
2017-01-18 05:38:59 -05:00
|
|
|
|
2017-11-18 09:06:55 -05:00
|
|
|
after(:build) do |commit, evaluator|
|
2017-08-04 13:14:04 -04:00
|
|
|
allow(commit).to receive(:author).and_return(evaluator.author || build_stubbed(:author))
|
2017-07-17 15:26:41 -04:00
|
|
|
end
|
|
|
|
|
2017-01-18 05:38:59 -05:00
|
|
|
trait :without_author do
|
2017-07-17 15:26:41 -04:00
|
|
|
after(:build) do |commit|
|
|
|
|
allow(commit).to receive(:author).and_return nil
|
|
|
|
end
|
2017-01-18 05:38:59 -05:00
|
|
|
end
|
2016-04-13 05:25:42 -04:00
|
|
|
end
|
|
|
|
end
|