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
1
Merge Requests
1
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
nexedi
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
Hide 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
...
@@ -23,7 +23,7 @@ FactoryBot.define do
end
end
after
(
:build
)
do
|
commit
,
evaluator
|
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
end
trait
:without_author
do
trait
:without_author
do
...
...
spec/factories/deployments.rb
View file @
a2718eba
...
@@ -3,13 +3,14 @@ FactoryBot.define do
...
@@ -3,13 +3,14 @@ FactoryBot.define do
sha
'97de212e80737a608d939f648d959671fb0a0142'
sha
'97de212e80737a608d939f648d959671fb0a0142'
ref
'master'
ref
'master'
tag
false
tag
false
user
user
nil
project
nil
project
nil
deployable
factory: :ci_build
deployable
factory: :ci_build
environment
factory: :environment
environment
factory: :environment
after
(
:build
)
do
|
deployment
,
evaluator
|
after
(
:build
)
do
|
deployment
,
evaluator
|
deployment
.
project
||=
deployment
.
environment
.
project
deployment
.
project
||=
deployment
.
environment
.
project
deployment
.
user
||=
deployment
.
project
.
creator
unless
deployment
.
project
.
repository_exists?
unless
deployment
.
project
.
repository_exists?
allow
(
deployment
.
project
.
repository
).
to
receive
(
:create_ref
)
allow
(
deployment
.
project
.
repository
).
to
receive
(
:create_ref
)
...
...
spec/factories/events.rb
View file @
a2718eba
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:event
do
factory
:event
do
project
project
author
factory: :user
author
(
factory: :user
)
{
project
.
creator
}
action
Event
::
JOINED
action
Event
::
JOINED
trait
(
:created
)
{
action
Event
::
CREATED
}
trait
(
:created
)
{
action
Event
::
CREATED
}
...
...
spec/factories/issues.rb
View file @
a2718eba
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:issue
do
factory
:issue
do
title
{
generate
(
:title
)
}
title
{
generate
(
:title
)
}
author
project
project
author
{
project
.
creator
}
trait
:confidential
do
trait
:confidential
do
confidential
true
confidential
true
...
...
spec/factories/merge_requests.rb
View file @
a2718eba
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:merge_request
do
factory
:merge_request
do
title
{
generate
(
:title
)
}
title
{
generate
(
:title
)
}
author
association
:source_project
,
:repository
,
factory: :project
association
:source_project
,
:repository
,
factory: :project
target_project
{
source_project
}
target_project
{
source_project
}
author
{
source_project
.
creator
}
# $ git log --pretty=oneline feature..master
# $ git log --pretty=oneline feature..master
# 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com
# 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com
...
...
spec/factories/notes.rb
View file @
a2718eba
...
@@ -6,7 +6,7 @@ FactoryBot.define do
...
@@ -6,7 +6,7 @@ FactoryBot.define do
factory
:note
do
factory
:note
do
project
project
note
{
generate
(
:title
)
}
note
{
generate
(
:title
)
}
author
author
{
project
&
.
creator
||
create
(
:user
)
}
on_issue
on_issue
factory
:note_on_commit
,
traits:
[
:on_commit
]
factory
:note_on_commit
,
traits:
[
:on_commit
]
...
...
spec/factories/project_wikis.rb
View file @
a2718eba
...
@@ -3,7 +3,7 @@ FactoryBot.define do
...
@@ -3,7 +3,7 @@ FactoryBot.define do
skip_create
skip_create
project
project
user
factory: :user
user
{
project
.
creator
}
initialize_with
{
new
(
project
,
user
)
}
initialize_with
{
new
(
project
,
user
)
}
end
end
end
end
spec/factories/sent_notifications.rb
View file @
a2718eba
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:sent_notification
do
factory
:sent_notification
do
project
project
recipient
factory: :user
recipient
{
project
.
creator
}
noteable
{
create
(
:issue
,
project:
project
)
}
noteable
{
create
(
:issue
,
project:
project
)
}
reply_key
{
SentNotification
.
reply_key
}
reply_key
{
SentNotification
.
reply_key
}
end
end
...
...
spec/factories/snippets.rb
View file @
a2718eba
...
@@ -21,6 +21,7 @@ FactoryBot.define do
...
@@ -21,6 +21,7 @@ FactoryBot.define do
factory
:project_snippet
,
parent: :snippet
,
class: :ProjectSnippet
do
factory
:project_snippet
,
parent: :snippet
,
class: :ProjectSnippet
do
project
project
author
{
project
.
creator
}
end
end
factory
:personal_snippet
,
parent: :snippet
,
class: :PersonalSnippet
do
factory
:personal_snippet
,
parent: :snippet
,
class: :PersonalSnippet
do
...
...
spec/factories/subscriptions.rb
View file @
a2718eba
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:subscription
do
factory
:subscription
do
user
project
project
user
{
project
.
creator
}
subscribable
factory: :issue
subscribable
factory: :issue
end
end
end
end
spec/factories/timelogs.rb
View file @
a2718eba
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:timelog
do
factory
:timelog
do
time_spent
3600
time_spent
3600
user
issue
issue
user
{
issue
.
project
.
creator
}
end
end
end
end
spec/factories/todos.rb
View file @
a2718eba
FactoryBot
.
define
do
FactoryBot
.
define
do
factory
:todo
do
factory
:todo
do
project
project
author
author
{
project
.
creator
}
user
user
{
project
.
creator
}
target
factory: :issue
target
factory: :issue
action
{
Todo
::
ASSIGNED
}
action
{
Todo
::
ASSIGNED
}
...
...
spec/features/dashboard/merge_requests_spec.rb
View file @
a2718eba
...
@@ -44,36 +44,38 @@ feature 'Dashboard Merge Requests' do
...
@@ -44,36 +44,38 @@ feature 'Dashboard Merge Requests' do
context
'merge requests exist'
do
context
'merge requests exist'
do
let!
(
:assigned_merge_request
)
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
end
let!
(
:assigned_merge_request_from_fork
)
do
let!
(
:assigned_merge_request_from_fork
)
do
create
(
:merge_request
,
create
(
:merge_request
,
source_branch:
'markdown'
,
assignee:
current_user
,
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
end
let!
(
:authored_merge_request
)
do
let!
(
:authored_merge_request
)
do
create
(
:merge_request
,
create
(
:merge_request
,
source_branch:
'markdown'
,
author:
current_user
,
source_branch:
'markdown'
,
target_project:
project
,
source_project:
project
source_project:
project
,
)
author:
current_user
)
end
end
let!
(
:authored_merge_request_from_fork
)
do
let!
(
:authored_merge_request_from_fork
)
do
create
(
:merge_request
,
create
(
:merge_request
,
source_branch:
'feature_conflict'
,
source_branch:
'feature_conflict'
,
author:
current_user
,
author:
current_user
,
target_project:
public_project
,
source_project:
forked_project
target_project:
public_project
,
source_project:
forked_project
)
)
end
end
let!
(
:other_merge_request
)
do
let!
(
:other_merge_request
)
do
create
(
:merge_request
,
create
(
:merge_request
,
source_branch:
'fix'
,
source_branch:
'fix'
,
target_project:
project
,
source_project:
project
source_project:
project
,
)
author:
create
(
:user
)
)
end
end
before
do
before
do
...
...
spec/features/merge_request/user_awards_emoji_spec.rb
View file @
a2718eba
...
@@ -3,7 +3,7 @@ require 'rails_helper'
...
@@ -3,7 +3,7 @@ require 'rails_helper'
describe
'Merge request > User awards emoji'
,
:js
do
describe
'Merge request > User awards emoji'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
project
.
creator
}
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
describe
'logged in'
do
before
do
before
do
...
...
spec/lib/gitlab/slash_commands/issue_search_spec.rb
View file @
a2718eba
...
@@ -5,7 +5,7 @@ describe Gitlab::SlashCommands::IssueSearch do
...
@@ -5,7 +5,7 @@ describe Gitlab::SlashCommands::IssueSearch do
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
title:
'find me'
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
title:
'find me'
)
}
let!
(
:confidential
)
{
create
(
:issue
,
:confidential
,
project:
project
,
title:
'mepmep find'
)
}
let!
(
:confidential
)
{
create
(
:issue
,
:confidential
,
project:
project
,
title:
'mepmep find'
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
issue
.
author
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:regex_match
)
{
described_class
.
match
(
"issue search find"
)
}
let
(
:regex_match
)
{
described_class
.
match
(
"issue search find"
)
}
subject
do
subject
do
...
...
spec/policies/project_policy_spec.rb
View file @
a2718eba
...
@@ -92,7 +92,7 @@ describe ProjectPolicy do
...
@@ -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
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
)
project
=
create
(
:project
,
:private
)
issue
=
create
(
:issue
,
project:
project
)
issue
=
create
(
:issue
,
project:
project
,
author:
create
(
:user
)
)
user
=
issue
.
author
user
=
issue
.
author
expect
(
project
.
team
.
member?
(
issue
.
author
)).
to
be
false
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
...
@@ -4,7 +4,7 @@ describe Issues::CloseService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:guest
)
{
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
(
:project
)
{
issue
.
project
}
let!
(
:todo
)
{
create
(
:todo
,
:assigned
,
user:
user
,
project:
project
,
target:
issue
,
author:
user2
)
}
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
...
@@ -13,7 +13,8 @@ describe Issues::UpdateService, :mailer do
create
(
:issue
,
title:
'Old title'
,
create
(
:issue
,
title:
'Old title'
,
description:
"for
#{
user2
.
to_reference
}
"
,
description:
"for
#{
user2
.
to_reference
}
"
,
assignee_ids:
[
user3
.
id
],
assignee_ids:
[
user3
.
id
],
project:
project
)
project:
project
,
author:
create
(
:user
))
end
end
before
do
before
do
...
...
spec/services/merge_requests/close_service_spec.rb
View file @
a2718eba
...
@@ -4,7 +4,7 @@ describe MergeRequests::CloseService do
...
@@ -4,7 +4,7 @@ describe MergeRequests::CloseService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:guest
)
{
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
(
:project
)
{
merge_request
.
project
}
let!
(
:todo
)
{
create
(
:todo
,
:assigned
,
user:
user
,
project:
project
,
target:
merge_request
,
author:
user2
)
}
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
...
@@ -7,7 +7,8 @@ describe MergeRequests::FfMergeService do
create
(
:merge_request
,
create
(
:merge_request
,
source_branch:
'flatten-dir'
,
source_branch:
'flatten-dir'
,
target_branch:
'improve/awesome'
,
target_branch:
'improve/awesome'
,
assignee:
user2
)
assignee:
user2
,
author:
create
(
:user
))
end
end
let
(
:project
)
{
merge_request
.
project
}
let
(
:project
)
{
merge_request
.
project
}
...
...
spec/services/merge_requests/reopen_service_spec.rb
View file @
a2718eba
...
@@ -4,7 +4,7 @@ describe MergeRequests::ReopenService do
...
@@ -4,7 +4,7 @@ describe MergeRequests::ReopenService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:guest
)
{
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
}
let
(
:project
)
{
merge_request
.
project
}
before
do
before
do
...
...
spec/services/merge_requests/update_service_spec.rb
View file @
a2718eba
...
@@ -12,7 +12,8 @@ describe MergeRequests::UpdateService, :mailer do
...
@@ -12,7 +12,8 @@ describe MergeRequests::UpdateService, :mailer do
create
(
:merge_request
,
:simple
,
title:
'Old title'
,
create
(
:merge_request
,
:simple
,
title:
'Old title'
,
description:
"FYI
#{
user2
.
to_reference
}
"
,
description:
"FYI
#{
user2
.
to_reference
}
"
,
assignee_id:
user3
.
id
,
assignee_id:
user3
.
id
,
source_project:
project
)
source_project:
project
,
author:
create
(
:user
))
end
end
before
do
before
do
...
...
spec/services/notification_service_spec.rb
View file @
a2718eba
...
@@ -458,7 +458,7 @@ describe NotificationService, :mailer do
...
@@ -458,7 +458,7 @@ describe NotificationService, :mailer do
context
"merge request diff note"
do
context
"merge request diff note"
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
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
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
before
do
before
do
...
@@ -469,11 +469,13 @@ describe NotificationService, :mailer do
...
@@ -469,11 +469,13 @@ describe NotificationService, :mailer do
describe
'#new_note'
do
describe
'#new_note'
do
it
"records sent notifications"
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
expect
(
SentNotification
).
to
receive
(
:record_note
).
with
(
note
,
any_args
).
exactly
(
3
).
times
.
and_call_original
notification
.
new_note
(
note
)
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
)
expect
(
SentNotification
.
last
.
in_reply_to_discussion_id
).
to
eq
(
note
.
discussion_id
)
end
end
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