summaryrefslogtreecommitdiff
path: root/spec/factories/commits.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/commits.rb')
-rw-r--r--spec/factories/commits.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/factories/commits.rb b/spec/factories/commits.rb
index ac6eb0a7897..89e260cf65b 100644
--- a/spec/factories/commits.rb
+++ b/spec/factories/commits.rb
@@ -8,5 +8,15 @@ FactoryGirl.define do
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