summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/fixtures/development/18_abuse_reports.rb32
-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
5 files changed, 31 insertions, 28 deletions
diff --git a/db/fixtures/development/18_abuse_reports.rb b/db/fixtures/development/18_abuse_reports.rb
index 7e67262b59e..762fab5f0ab 100644
--- a/db/fixtures/development/18_abuse_reports.rb
+++ b/db/fixtures/development/18_abuse_reports.rb
@@ -1,20 +1,22 @@
module Db
module Fixtures
- class Development
- def self.seed
- Gitlab::Seeder.quiet do
- (AbuseReport.default_per_page + 3).times do
- reported_user =
- User.create!(
- username: FFaker::Internet.user_name,
- name: FFaker::Name.name,
- email: FFaker::Internet.email,
- confirmed_at: DateTime.now,
- password: '12345678'
- )
+ module Development
+ class AbuseReport
+ def self.seed
+ Gitlab::Seeder.quiet do
+ (::AbuseReport.default_per_page + 3).times do
+ reported_user =
+ ::User.create!(
+ username: FFaker::Internet.user_name,
+ name: FFaker::Name.name,
+ email: FFaker::Internet.email,
+ confirmed_at: DateTime.now,
+ password: '12345678'
+ )
- AbuseReport.create(reporter: User.take, user: reported_user, message: 'User sends spam')
- print '.'
+ ::AbuseReport.create(reporter: ::User.take, user: reported_user, message: 'User sends spam')
+ print '.'
+ end
end
end
end
@@ -22,4 +24,4 @@ module Db
end
end
-Db::Fixtures::Development.seed
+Db::Fixtures::Development::AbuseReport.seed
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