summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-03-21 18:52:55 +0100
committerJames Lopez <james@jameslopez.es>2016-03-21 18:52:55 +0100
commitcae864a12e3c99d642fb812fff3941e9f5271f95 (patch)
treefce4b24fc294e9566a56027dcb327805d6a01ae7 /spec/factories
parent4196ee0661d705c81ca49294926bfaa28d725119 (diff)
parent2bcbc7c6db934d56448c4c261861e62982b9b573 (diff)
downloadgitlab-ce-cae864a12e3c99d642fb812fff3941e9f5271f95.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into fix/safe-import-url
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/issues.rb4
-rw-r--r--spec/factories/labels.rb2
-rw-r--r--spec/factories/merge_requests.rb10
-rw-r--r--spec/factories/personal_snippets.rb11
-rw-r--r--spec/factories/project_group_links.rb6
-rw-r--r--spec/factories/project_snippets.rb6
-rw-r--r--spec/factories/snippets.rb12
-rw-r--r--spec/factories/todos.rb10
-rw-r--r--spec/factories/users.rb7
9 files changed, 42 insertions, 26 deletions
diff --git a/spec/factories/issues.rb b/spec/factories/issues.rb
index 722095de590..e72aa9479b7 100644
--- a/spec/factories/issues.rb
+++ b/spec/factories/issues.rb
@@ -4,6 +4,10 @@ FactoryGirl.define do
author
project
+ trait :confidential do
+ confidential true
+ end
+
trait :closed do
state :closed
end
diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb
index 6e70af10af3..ea2be8928d5 100644
--- a/spec/factories/labels.rb
+++ b/spec/factories/labels.rb
@@ -13,7 +13,7 @@
FactoryGirl.define do
factory :label do
- title "Bug"
+ sequence(:title) { |n| "label#{n}" }
color "#990000"
project
end
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb
index ca1c636fce4..e281e2f227b 100644
--- a/spec/factories/merge_requests.rb
+++ b/spec/factories/merge_requests.rb
@@ -51,11 +51,20 @@ FactoryGirl.define do
trait :with_diffs do
end
+ trait :without_diffs do
+ source_branch "improve/awesome"
+ target_branch "master"
+ end
+
trait :conflict do
source_branch "feature_conflict"
target_branch "feature"
end
+ trait :merged do
+ state :merged
+ end
+
trait :closed do
state :closed
end
@@ -84,6 +93,7 @@ FactoryGirl.define do
merge_user author
end
+ factory :merged_merge_request, traits: [:merged]
factory :closed_merge_request, traits: [:closed]
factory :reopened_merge_request, traits: [:reopened]
factory :merge_request_with_diffs, traits: [:with_diffs]
diff --git a/spec/factories/personal_snippets.rb b/spec/factories/personal_snippets.rb
index b493a6968ff..0f13b2c1020 100644
--- a/spec/factories/personal_snippets.rb
+++ b/spec/factories/personal_snippets.rb
@@ -1,15 +1,4 @@
FactoryGirl.define do
factory :personal_snippet, parent: :snippet, class: :PersonalSnippet do
- trait :public do
- visibility_level PersonalSnippet::PUBLIC
- end
-
- trait :internal do
- visibility_level PersonalSnippet::INTERNAL
- end
-
- trait :private do
- visibility_level PersonalSnippet::PRIVATE
- end
end
end
diff --git a/spec/factories/project_group_links.rb b/spec/factories/project_group_links.rb
new file mode 100644
index 00000000000..e73cc05f9d7
--- /dev/null
+++ b/spec/factories/project_group_links.rb
@@ -0,0 +1,6 @@
+FactoryGirl.define do
+ factory :project_group_link do
+ project
+ group
+ end
+end
diff --git a/spec/factories/project_snippets.rb b/spec/factories/project_snippets.rb
index 154442bd3db..d681a2c8483 100644
--- a/spec/factories/project_snippets.rb
+++ b/spec/factories/project_snippets.rb
@@ -1,9 +1,5 @@
FactoryGirl.define do
- factory :project_snippet do
+ factory :project_snippet, parent: :snippet, class: :ProjectSnippet do
project
- author
- title
- content
- file_name
end
end
diff --git a/spec/factories/snippets.rb b/spec/factories/snippets.rb
index b9127b3d75e..365f12a0c95 100644
--- a/spec/factories/snippets.rb
+++ b/spec/factories/snippets.rb
@@ -12,5 +12,17 @@ FactoryGirl.define do
title
content
file_name
+
+ trait :public do
+ visibility_level Snippet::PUBLIC
+ end
+
+ trait :internal do
+ visibility_level Snippet::INTERNAL
+ end
+
+ trait :private do
+ visibility_level Snippet::PRIVATE
+ end
end
end
diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb
index bd85b1d798a..7ae06c27840 100644
--- a/spec/factories/todos.rb
+++ b/spec/factories/todos.rb
@@ -5,14 +5,15 @@
# id :integer not null, primary key
# user_id :integer not null
# project_id :integer not null
-# target_id :integer not null
+# target_id :integer
# target_type :string not null
# author_id :integer
-# note_id :integer
# action :integer not null
# state :string not null
# created_at :datetime
# updated_at :datetime
+# note_id :integer
+# commit_id :string
#
FactoryGirl.define do
@@ -30,5 +31,10 @@ FactoryGirl.define do
trait :mentioned do
action { Todo::MENTIONED }
end
+
+ trait :on_commit do
+ commit_id RepoHelpers.sample_commit.id
+ target_type "Commit"
+ end
end
end
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index 785c2a3d811..a5c60c51c5b 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -23,13 +23,6 @@ FactoryGirl.define do
end
end
- trait :with_avatar do
- avatar { fixture_file_upload(Rails.root.join(*%w(spec fixtures dk.png)), 'image/png') }
- avatar_crop_x 0
- avatar_crop_y 0
- avatar_crop_size 256
- end
-
factory :omniauth_user do
transient do
extern_uid '123456'