Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
58fe40fb
Commit
58fe40fb
authored
Mar 24, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use FFaker in factories, use sequences instead
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
169dc4ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
28 deletions
+31
-28
db/fixtures/development/18_abuse_reports.rb
db/fixtures/development/18_abuse_reports.rb
+17
-15
spec/factories/labels.rb
spec/factories/labels.rb
+6
-5
spec/factories/sequences.rb
spec/factories/sequences.rb
+2
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+3
-3
spec/requests/api/v3/issues_spec.rb
spec/requests/api/v3/issues_spec.rb
+3
-3
No files found.
db/fixtures/development/18_abuse_reports.rb
View file @
58fe40fb
module
Db
module
Db
module
Fixtures
module
Fixtures
class
Development
module
Development
def
self
.
seed
class
AbuseReport
Gitlab
::
Seeder
.
quiet
do
def
self
.
seed
(
AbuseReport
.
default_per_page
+
3
).
times
do
Gitlab
::
Seeder
.
quiet
do
reported_user
=
(
::
AbuseReport
.
default_per_page
+
3
).
times
do
User
.
create!
(
reported_user
=
username:
FFaker
::
Internet
.
user_name
,
::
User
.
create!
(
name:
FFaker
::
Name
.
name
,
username:
FFaker
::
Internet
.
user_name
,
email:
FFaker
::
Internet
.
email
,
name:
FFaker
::
Name
.
name
,
confirmed_at:
DateTime
.
now
,
email:
FFaker
::
Internet
.
email
,
password:
'12345678'
confirmed_at:
DateTime
.
now
,
)
password:
'12345678'
)
AbuseReport
.
create
(
reporter:
User
.
take
,
user:
reported_user
,
message:
'User sends spam'
)
::
AbuseReport
.
create
(
reporter:
::
User
.
take
,
user:
reported_user
,
message:
'User sends spam'
)
print
'.'
print
'.'
end
end
end
end
end
end
end
...
@@ -22,4 +24,4 @@ module Db
...
@@ -22,4 +24,4 @@ module Db
end
end
end
end
Db
::
Fixtures
::
Development
.
seed
Db
::
Fixtures
::
Development
::
AbuseReport
.
seed
spec/factories/labels.rb
View file @
58fe40fb
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:label
,
class:
ProjectL
abel
do
trait
:base_l
abel
do
title
{
generate
(
:label
)
}
title
{
generate
(
:label
_title
)
}
color
"#990000"
color
"#990000"
end
factory
:label
,
traits:
[
:base_label
],
class:
ProjectLabel
do
project
factory: :empty_project
project
factory: :empty_project
transient
do
transient
do
...
@@ -15,9 +18,7 @@ FactoryGirl.define do
...
@@ -15,9 +18,7 @@ FactoryGirl.define do
end
end
end
end
factory
:group_label
,
class:
GroupLabel
do
factory
:group_label
,
traits:
[
:base_label
]
do
title
{
generate
(
:label
)
}
color
"#990000"
group
group
end
end
end
end
spec/factories/sequences.rb
View file @
58fe40fb
...
@@ -6,7 +6,7 @@ FactoryGirl.define do
...
@@ -6,7 +6,7 @@ FactoryGirl.define do
sequence
(
:title
)
{
|
n
|
"My title
#{
n
}
"
}
sequence
(
:title
)
{
|
n
|
"My title
#{
n
}
"
}
sequence
(
:filename
)
{
|
n
|
"filename-
#{
n
}
.rb"
}
sequence
(
:filename
)
{
|
n
|
"filename-
#{
n
}
.rb"
}
sequence
(
:url
)
{
|
n
|
"http://example
#{
n
}
.org"
}
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
(
: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
end
spec/requests/api/issues_spec.rb
View file @
58fe40fb
...
@@ -19,7 +19,7 @@ describe API::Issues, api: true do
...
@@ -19,7 +19,7 @@ describe API::Issues, api: true do
project:
project
,
project:
project
,
state: :closed
,
state: :closed
,
milestone:
milestone
,
milestone:
milestone
,
created_at:
generate
(
:
issue_created_at
),
created_at:
generate
(
:
past_time
),
updated_at:
3
.
hours
.
ago
updated_at:
3
.
hours
.
ago
end
end
let!
(
:confidential_issue
)
do
let!
(
:confidential_issue
)
do
...
@@ -28,7 +28,7 @@ describe API::Issues, api: true do
...
@@ -28,7 +28,7 @@ describe API::Issues, api: true do
project:
project
,
project:
project
,
author:
author
,
author:
author
,
assignee:
assignee
,
assignee:
assignee
,
created_at:
generate
(
:
issue_created_at
),
created_at:
generate
(
:
past_time
),
updated_at:
2
.
hours
.
ago
updated_at:
2
.
hours
.
ago
end
end
let!
(
:issue
)
do
let!
(
:issue
)
do
...
@@ -37,7 +37,7 @@ describe API::Issues, api: true do
...
@@ -37,7 +37,7 @@ describe API::Issues, api: true do
assignee:
user
,
assignee:
user
,
project:
project
,
project:
project
,
milestone:
milestone
,
milestone:
milestone
,
created_at:
generate
(
:
issue_created_at
),
created_at:
generate
(
:
past_time
),
updated_at:
1
.
hour
.
ago
updated_at:
1
.
hour
.
ago
end
end
let!
(
:label
)
do
let!
(
:label
)
do
...
...
spec/requests/api/v3/issues_spec.rb
View file @
58fe40fb
...
@@ -19,7 +19,7 @@ describe API::V3::Issues, api: true do
...
@@ -19,7 +19,7 @@ describe API::V3::Issues, api: true do
project:
project
,
project:
project
,
state: :closed
,
state: :closed
,
milestone:
milestone
,
milestone:
milestone
,
created_at:
generate
(
:
issue_created_at
),
created_at:
generate
(
:
past_time
),
updated_at:
3
.
hours
.
ago
updated_at:
3
.
hours
.
ago
end
end
let!
(
:confidential_issue
)
do
let!
(
:confidential_issue
)
do
...
@@ -28,7 +28,7 @@ describe API::V3::Issues, api: true do
...
@@ -28,7 +28,7 @@ describe API::V3::Issues, api: true do
project:
project
,
project:
project
,
author:
author
,
author:
author
,
assignee:
assignee
,
assignee:
assignee
,
created_at:
generate
(
:
issue_created_at
),
created_at:
generate
(
:
past_time
),
updated_at:
2
.
hours
.
ago
updated_at:
2
.
hours
.
ago
end
end
let!
(
:issue
)
do
let!
(
:issue
)
do
...
@@ -37,7 +37,7 @@ describe API::V3::Issues, api: true do
...
@@ -37,7 +37,7 @@ describe API::V3::Issues, api: true do
assignee:
user
,
assignee:
user
,
project:
project
,
project:
project
,
milestone:
milestone
,
milestone:
milestone
,
created_at:
generate
(
:
issue_created_at
),
created_at:
generate
(
:
past_time
),
updated_at:
1
.
hour
.
ago
updated_at:
1
.
hour
.
ago
end
end
let!
(
:label
)
do
let!
(
:label
)
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment