gitlab-org--gitlab-foss/spec/factories/todos.rb
Rémy Coutable 4af9d592c5 Replace factory_girl_rails with factory_bot_rails
I've followed the [upgrade guide](https://github.com/thoughtbot/factory_bot/blob/4-9-0-stable/UPGRADE_FROM_FACTORY_GIRL.md) and ran these two commands:

```
grep -e FactoryGirl **/*.rake **/*.rb -s -l | xargs sed -i "" "s|FactoryGirl|FactoryBot|"
grep -e factory_girl **/*.rake **/*.rb -s -l | xargs sed -i "" "s|factory_girl|factory_bot|"
```

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-12-14 15:01:55 +01:00

55 lines
951 B
Ruby

FactoryBot.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 :directly_addressed do
action { Todo::DIRECTLY_ADDRESSED }
end
trait :build_failed do
action { Todo::BUILD_FAILED }
target factory: :merge_request
end
trait :marked do
action { Todo::MARKED }
end
trait :approval_required do
action { Todo::APPROVAL_REQUIRED }
end
trait :unmergeable do
action { Todo::UNMERGEABLE }
end
trait :pending do
state :pending
end
trait :done do
state :done
end
end
factory :on_commit_todo, class: Todo do
project
author
user
action { Todo::ASSIGNED }
commit_id RepoHelpers.sample_commit.id
target_type "Commit"
end
end