summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-24 19:12:22 +0100
committerRémy Coutable <remy@rymai.me>2017-04-03 18:54:48 +0200
commit58fe40fbd38dce5d42f5f36681780579fb3f031b (patch)
tree8c902c1a5f79c3479ad17a1e02c8c2b731cb10d0 /spec
parent169dc4cec1f45cdcc548e3e682e4fd6f4c98926a (diff)
downloadgitlab-ce-58fe40fbd38dce5d42f5f36681780579fb3f031b.tar.gz
Don't use FFaker in factories, use sequences instead
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/labels.rb11
-rw-r--r--spec/factories/sequences.rb4
-rw-r--r--spec/requests/api/issues_spec.rb6
-rw-r--r--spec/requests/api/v3/issues_spec.rb6
4 files changed, 14 insertions, 13 deletions
diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb
index 5706ab6a767..22c2a1f15e2 100644
--- a/spec/factories/labels.rb
+++ b/spec/factories/labels.rb
@@ -1,7 +1,10 @@
FactoryGirl.define do
- factory :label, class: ProjectLabel do
- title { generate(:label) }
+ trait :base_label do
+ title { generate(:label_title) }
color "#990000"
+ end
+
+ factory :label, traits: [:base_label], class: ProjectLabel do
project factory: :empty_project
transient do
@@ -15,9 +18,7 @@ FactoryGirl.define do
end
end
- factory :group_label, class: GroupLabel do
- title { generate(:label) }
- color "#990000"
+ factory :group_label, traits: [:base_label] do
group
end
end
diff --git a/spec/factories/sequences.rb b/spec/factories/sequences.rb
index 2321455bfee..c0232ba5bf6 100644
--- a/spec/factories/sequences.rb
+++ b/spec/factories/sequences.rb
@@ -6,7 +6,7 @@ FactoryGirl.define do
sequence(:title) { |n| "My title #{n}" }
sequence(:filename) { |n| "filename-#{n}.rb" }
sequence(:url) { |n| "http://example#{n}.org" }
- sequence(:label) { |n| "label#{n}" }
+ sequence(:label_title) { |n| "label#{n}" }
sequence(:branch) { |n| "my-branch-#{n}" }
- sequence(:issue_created_at) { |n| 4.hours.ago + (2 * n).seconds }
+ sequence(:past_time) { |n| 4.hours.ago + (2 * n).seconds }
end
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index 91d6fb83c0b..4729adba11c 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -19,7 +19,7 @@ describe API::Issues, api: true do
project: project,
state: :closed,
milestone: milestone,
- created_at: generate(:issue_created_at),
+ created_at: generate(:past_time),
updated_at: 3.hours.ago
end
let!(:confidential_issue) do
@@ -28,7 +28,7 @@ describe API::Issues, api: true do
project: project,
author: author,
assignee: assignee,
- created_at: generate(:issue_created_at),
+ created_at: generate(:past_time),
updated_at: 2.hours.ago
end
let!(:issue) do
@@ -37,7 +37,7 @@ describe API::Issues, api: true do
assignee: user,
project: project,
milestone: milestone,
- created_at: generate(:issue_created_at),
+ created_at: generate(:past_time),
updated_at: 1.hour.ago
end
let!(:label) do
diff --git a/spec/requests/api/v3/issues_spec.rb b/spec/requests/api/v3/issues_spec.rb
index 383871d5c38..b1b398a897e 100644
--- a/spec/requests/api/v3/issues_spec.rb
+++ b/spec/requests/api/v3/issues_spec.rb
@@ -19,7 +19,7 @@ describe API::V3::Issues, api: true do
project: project,
state: :closed,
milestone: milestone,
- created_at: generate(:issue_created_at),
+ created_at: generate(:past_time),
updated_at: 3.hours.ago
end
let!(:confidential_issue) do
@@ -28,7 +28,7 @@ describe API::V3::Issues, api: true do
project: project,
author: author,
assignee: assignee,
- created_at: generate(:issue_created_at),
+ created_at: generate(:past_time),
updated_at: 2.hours.ago
end
let!(:issue) do
@@ -37,7 +37,7 @@ describe API::V3::Issues, api: true do
assignee: user,
project: project,
milestone: milestone,
- created_at: generate(:issue_created_at),
+ created_at: generate(:past_time),
updated_at: 1.hour.ago
end
let!(:label) do