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
a2718eba
Commit
a2718eba
authored
Aug 04, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make user/author use project.creator in most factories
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
9c34c023
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
42 additions
and
33 deletions
+42
-33
spec/factories/commits.rb
spec/factories/commits.rb
+1
-1
spec/factories/deployments.rb
spec/factories/deployments.rb
+2
-1
spec/factories/events.rb
spec/factories/events.rb
+1
-1
spec/factories/issues.rb
spec/factories/issues.rb
+1
-1
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+1
-1
spec/factories/notes.rb
spec/factories/notes.rb
+1
-1
spec/factories/project_wikis.rb
spec/factories/project_wikis.rb
+1
-1
spec/factories/sent_notifications.rb
spec/factories/sent_notifications.rb
+1
-1
spec/factories/snippets.rb
spec/factories/snippets.rb
+1
-0
spec/factories/subscriptions.rb
spec/factories/subscriptions.rb
+1
-1
spec/factories/timelogs.rb
spec/factories/timelogs.rb
+1
-1
spec/factories/todos.rb
spec/factories/todos.rb
+2
-2
spec/features/dashboard/merge_requests_spec.rb
spec/features/dashboard/merge_requests_spec.rb
+12
-10
spec/features/merge_request/user_awards_emoji_spec.rb
spec/features/merge_request/user_awards_emoji_spec.rb
+1
-1
spec/lib/gitlab/slash_commands/issue_search_spec.rb
spec/lib/gitlab/slash_commands/issue_search_spec.rb
+1
-1
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+1
-1
spec/services/issues/close_service_spec.rb
spec/services/issues/close_service_spec.rb
+1
-1
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+2
-1
spec/services/merge_requests/close_service_spec.rb
spec/services/merge_requests/close_service_spec.rb
+1
-1
spec/services/merge_requests/ff_merge_service_spec.rb
spec/services/merge_requests/ff_merge_service_spec.rb
+2
-1
spec/services/merge_requests/reopen_service_spec.rb
spec/services/merge_requests/reopen_service_spec.rb
+1
-1
spec/services/merge_requests/update_service_spec.rb
spec/services/merge_requests/update_service_spec.rb
+2
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+4
-2
No files found.
spec/factories/commits.rb
View file @
a2718eba
...
...
@@ -23,7 +23,7 @@ FactoryBot.define do
end
after
(
:build
)
do
|
commit
,
evaluator
|
allow
(
commit
).
to
receive
(
:author
).
and_return
(
evaluator
.
author
||
build
(
:author
))
allow
(
commit
).
to
receive
(
:author
).
and_return
(
evaluator
.
author
||
build
_stubbed
(
:author
))
end
trait
:without_author
do
...
...
spec/factories/deployments.rb
View file @
a2718eba
...
...
@@ -3,13 +3,14 @@ FactoryBot.define do
sha
'97de212e80737a608d939f648d959671fb0a0142'
ref
'master'
tag
false
user
user
nil
project
nil
deployable
factory: :ci_build
environment
factory: :environment
after
(
:build
)
do
|
deployment
,
evaluator
|
deployment
.
project
||=
deployment
.
environment
.
project
deployment
.
user
||=
deployment
.
project
.
creator
unless
deployment
.
project
.
repository_exists?
allow
(
deployment
.
project
.
repository
).
to
receive
(
:create_ref
)
...
...
spec/factories/events.rb
View file @
a2718eba
FactoryBot
.
define
do
factory
:event
do
project
author
factory: :user
author
(
factory: :user
)
{
project
.
creator
}
action
Event
::
JOINED
trait
(
:created
)
{
action
Event
::
CREATED
}
...
...
spec/factories/issues.rb
View file @
a2718eba
FactoryBot
.
define
do
factory
:issue
do
title
{
generate
(
:title
)
}
author
project
author
{
project
.
creator
}
trait
:confidential
do
confidential
true
...
...
spec/factories/merge_requests.rb
View file @
a2718eba
FactoryBot
.
define
do
factory
:merge_request
do
title
{
generate
(
:title
)
}
author
association
:source_project
,
:repository
,
factory: :project
target_project
{
source_project
}
author
{
source_project
.
creator
}
# $ git log --pretty=oneline feature..master
# 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com
...
...
spec/factories/notes.rb
View file @
a2718eba
...
...
@@ -6,7 +6,7 @@ FactoryBot.define do
factory
:note
do
project
note
{
generate
(
:title
)
}
author
author
{
project
&
.
creator
||
create
(
:user
)
}
on_issue
factory
:note_on_commit
,
traits:
[
:on_commit
]
...
...
spec/factories/project_wikis.rb
View file @
a2718eba
...
...
@@ -3,7 +3,7 @@ FactoryBot.define do
skip_create
project
user
factory: :user
user
{
project
.
creator
}
initialize_with
{
new
(
project
,
user
)
}
end
end
spec/factories/sent_notifications.rb
View file @
a2718eba
FactoryBot
.
define
do
factory
:sent_notification
do
project
recipient
factory: :user
recipient
{
project
.
creator
}
noteable
{
create
(
:issue
,
project:
project
)
}
reply_key
{
SentNotification
.
reply_key
}
end
...
...
spec/factories/snippets.rb
View file @
a2718eba
...
...
@@ -21,6 +21,7 @@ FactoryBot.define do
factory
:project_snippet
,
parent: :snippet
,
class: :ProjectSnippet
do
project
author
{
project
.
creator
}
end
factory
:personal_snippet
,
parent: :snippet
,
class: :PersonalSnippet
do
...
...
spec/factories/subscriptions.rb
View file @
a2718eba
FactoryBot
.
define
do
factory
:subscription
do
user
project
user
{
project
.
creator
}
subscribable
factory: :issue
end
end
spec/factories/timelogs.rb
View file @
a2718eba
...
...
@@ -3,7 +3,7 @@
FactoryBot
.
define
do
factory
:timelog
do
time_spent
3600
user
issue
user
{
issue
.
project
.
creator
}
end
end
spec/factories/todos.rb
View file @
a2718eba
FactoryBot
.
define
do
factory
:todo
do
project
author
user
author
{
project
.
creator
}
user
{
project
.
creator
}
target
factory: :issue
action
{
Todo
::
ASSIGNED
}
...
...
spec/features/dashboard/merge_requests_spec.rb
View file @
a2718eba
...
...
@@ -44,36 +44,38 @@ feature 'Dashboard Merge Requests' do
context
'merge requests exist'
do
let!
(
:assigned_merge_request
)
do
create
(
:merge_request
,
assignee:
current_user
,
target_project:
project
,
source_project:
project
)
create
(
:merge_request
,
assignee:
current_user
,
source_project:
project
,
author:
create
(
:user
))
end
let!
(
:assigned_merge_request_from_fork
)
do
create
(
:merge_request
,
source_branch:
'markdown'
,
assignee:
current_user
,
target_project:
public_project
,
source_project:
forked_project
)
target_project:
public_project
,
source_project:
forked_project
,
author:
create
(
:user
)
)
end
let!
(
:authored_merge_request
)
do
create
(
:merge_request
,
source_branch:
'markdown'
,
author:
current_user
,
target_project:
project
,
source_project:
project
)
source_branch:
'markdown'
,
source_project:
project
,
author:
current_user
)
end
let!
(
:authored_merge_request_from_fork
)
do
create
(
:merge_request
,
source_branch:
'feature_conflict'
,
author:
current_user
,
target_project:
public_project
,
source_project:
forked_project
)
target_project:
public_project
,
source_project:
forked_project
)
end
let!
(
:other_merge_request
)
do
create
(
:merge_request
,
source_branch:
'fix'
,
target_project:
project
,
source_project:
project
)
source_project:
project
,
author:
create
(
:user
)
)
end
before
do
...
...
spec/features/merge_request/user_awards_emoji_spec.rb
View file @
a2718eba
...
...
@@ -3,7 +3,7 @@ require 'rails_helper'
describe
'Merge request > User awards emoji'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
project
.
creator
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
author:
create
(
:user
)
)
}
describe
'logged in'
do
before
do
...
...
spec/lib/gitlab/slash_commands/issue_search_spec.rb
View file @
a2718eba
...
...
@@ -5,7 +5,7 @@ describe Gitlab::SlashCommands::IssueSearch do
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
title:
'find me'
)
}
let!
(
:confidential
)
{
create
(
:issue
,
:confidential
,
project:
project
,
title:
'mepmep find'
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
issue
.
author
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:regex_match
)
{
described_class
.
match
(
"issue search find"
)
}
subject
do
...
...
spec/policies/project_policy_spec.rb
View file @
a2718eba
...
...
@@ -92,7 +92,7 @@ describe ProjectPolicy do
it
'does not include the read_issue permission when the issue author is not a member of the private project'
do
project
=
create
(
:project
,
:private
)
issue
=
create
(
:issue
,
project:
project
)
issue
=
create
(
:issue
,
project:
project
,
author:
create
(
:user
)
)
user
=
issue
.
author
expect
(
project
.
team
.
member?
(
issue
.
author
)).
to
be
false
...
...
spec/services/issues/close_service_spec.rb
View file @
a2718eba
...
...
@@ -4,7 +4,7 @@ describe Issues::CloseService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
assignees:
[
user2
])
}
let
(
:issue
)
{
create
(
:issue
,
assignees:
[
user2
]
,
author:
create
(
:user
)
)
}
let
(
:project
)
{
issue
.
project
}
let!
(
:todo
)
{
create
(
:todo
,
:assigned
,
user:
user
,
project:
project
,
target:
issue
,
author:
user2
)
}
...
...
spec/services/issues/update_service_spec.rb
View file @
a2718eba
...
...
@@ -13,7 +13,8 @@ describe Issues::UpdateService, :mailer do
create
(
:issue
,
title:
'Old title'
,
description:
"for
#{
user2
.
to_reference
}
"
,
assignee_ids:
[
user3
.
id
],
project:
project
)
project:
project
,
author:
create
(
:user
))
end
before
do
...
...
spec/services/merge_requests/close_service_spec.rb
View file @
a2718eba
...
...
@@ -4,7 +4,7 @@ describe MergeRequests::CloseService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
assignee:
user2
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
assignee:
user2
,
author:
create
(
:user
)
)
}
let
(
:project
)
{
merge_request
.
project
}
let!
(
:todo
)
{
create
(
:todo
,
:assigned
,
user:
user
,
project:
project
,
target:
merge_request
,
author:
user2
)
}
...
...
spec/services/merge_requests/ff_merge_service_spec.rb
View file @
a2718eba
...
...
@@ -7,7 +7,8 @@ describe MergeRequests::FfMergeService do
create
(
:merge_request
,
source_branch:
'flatten-dir'
,
target_branch:
'improve/awesome'
,
assignee:
user2
)
assignee:
user2
,
author:
create
(
:user
))
end
let
(
:project
)
{
merge_request
.
project
}
...
...
spec/services/merge_requests/reopen_service_spec.rb
View file @
a2718eba
...
...
@@ -4,7 +4,7 @@ describe MergeRequests::ReopenService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
:closed
,
assignee:
user2
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
:closed
,
assignee:
user2
,
author:
create
(
:user
)
)
}
let
(
:project
)
{
merge_request
.
project
}
before
do
...
...
spec/services/merge_requests/update_service_spec.rb
View file @
a2718eba
...
...
@@ -12,7 +12,8 @@ describe MergeRequests::UpdateService, :mailer do
create
(
:merge_request
,
:simple
,
title:
'Old title'
,
description:
"FYI
#{
user2
.
to_reference
}
"
,
assignee_id:
user3
.
id
,
source_project:
project
)
source_project:
project
,
author:
create
(
:user
))
end
before
do
...
...
spec/services/notification_service_spec.rb
View file @
a2718eba
...
...
@@ -458,7 +458,7 @@ describe NotificationService, :mailer do
context
"merge request diff note"
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
assignee:
user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
assignee:
user
,
author:
create
(
:user
)
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
before
do
...
...
@@ -469,11 +469,13 @@ describe NotificationService, :mailer do
describe
'#new_note'
do
it
"records sent notifications"
do
#
Ensure create SentNotification by noteable = merge_request 6 times, not noteable = note
#
3 SentNotification are sent: the MR assignee and author, and the @u_watcher
expect
(
SentNotification
).
to
receive
(
:record_note
).
with
(
note
,
any_args
).
exactly
(
3
).
times
.
and_call_original
notification
.
new_note
(
note
)
expect
(
SentNotification
.
last
(
3
).
map
(
&
:recipient
).
map
(
&
:id
))
.
to
contain_exactly
(
merge_request
.
assignee
.
id
,
merge_request
.
author
.
id
,
@u_watcher
.
id
)
expect
(
SentNotification
.
last
.
in_reply_to_discussion_id
).
to
eq
(
note
.
discussion_id
)
end
end
...
...
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