summaryrefslogtreecommitdiff
path: root/spec/factories/commits.rb
blob: 89e260cf65bec04355ec6a783a37be3fe09f1438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require_relative '../support/repo_helpers'

FactoryGirl.define do
  factory :commit do
    git_commit RepoHelpers.sample_commit
    project factory: :empty_project

    initialize_with do
      new(git_commit, project)
    end

    after(:build) do |commit|
      allow(commit).to receive(:author).and_return build(:author)
    end

    trait :without_author do
      after(:build) do |commit|
        allow(commit).to receive(:author).and_return nil
      end
    end
  end
end