gitlab-org--gitlab-foss/spec/factories/todos.rb
Sean McGivern 6b834f2cbc Create a todo on failing MR build
When a build fails for a commit, create a todo for the author of the
merge request that commit is the HEAD of. If the commit isn't the HEAD
commit of any MR, don't do anything. If there already is a todo for that
user and MR, don't do anything.

Current limitations:
- This isn't configurable by project.
- The author of a merge request might not be the person who pushed the
  breaking commit.
2016-05-17 10:17:45 +01:00

26 lines
447 B
Ruby

FactoryGirl.define do
factory :todo do
project
author
user
target factory: :issue
action { Todo::ASSIGNED }
trait :assigned do
action { Todo::ASSIGNED }
end
trait :mentioned do
action { Todo::MENTIONED }
end
trait :on_commit do
commit_id RepoHelpers.sample_commit.id
target_type "Commit"
end
trait :build_failed do
action { Todo::BUILD_FAILED }
end
end
end