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
799459c3
Commit
799459c3
authored
Apr 03, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Multiple issue asignees] fix for spec/models/concerns/issuable_spec.rb[ci skip]
parent
01e1c664
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
20 deletions
+52
-20
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+14
-20
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+19
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+19
-0
No files found.
spec/models/concerns/issuable_spec.rb
View file @
799459c3
...
...
@@ -7,7 +7,6 @@ describe Issue, "Issuable" do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
belong_to
(
:author
)
}
it
{
is_expected
.
to
belong_to
(
:assignee
)
}
it
{
is_expected
.
to
have_many
(
:notes
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:todos
).
dependent
(
:destroy
)
}
...
...
@@ -339,7 +338,20 @@ describe Issue, "Issuable" do
end
context
"issue is assigned"
do
before
{
issue
.
update_attribute
(
:assignee
,
user
)
}
before
{
issue
.
assignees
<<
user
}
it
"returns correct hook data"
do
expect
(
data
[
:assignees
].
first
).
to
eq
(
user
.
hook_attrs
)
end
end
context
"merge_request is assigned"
do
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:data
)
{
merge_request
.
to_hook_data
(
user
)
}
before
do
merge_request
.
update_attribute
(
:assignee
,
user
)
end
it
"returns correct hook data"
do
expect
(
data
[
:object_attributes
][
'assignee_id'
]).
to
eq
(
user
.
id
)
...
...
@@ -361,24 +373,6 @@ describe Issue, "Issuable" do
include_examples
'deprecated repository hook data'
end
describe
'#card_attributes'
do
it
'includes the author name'
do
allow
(
issue
).
to
receive
(
:author
).
and_return
(
double
(
name:
'Robert'
))
allow
(
issue
).
to
receive
(
:assignee
).
and_return
(
nil
)
expect
(
issue
.
card_attributes
).
to
eq
({
'Author'
=>
'Robert'
,
'Assignee'
=>
nil
})
end
it
'includes the assignee name'
do
allow
(
issue
).
to
receive
(
:author
).
and_return
(
double
(
name:
'Robert'
))
allow
(
issue
).
to
receive
(
:assignee
).
and_return
(
double
(
name:
'Douwe'
))
expect
(
issue
.
card_attributes
).
to
eq
({
'Author'
=>
'Robert'
,
'Assignee'
=>
'Douwe'
})
end
end
describe
'#labels_array'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
...
...
spec/models/issue_spec.rb
View file @
799459c3
...
...
@@ -3,6 +3,7 @@ require 'spec_helper'
describe
Issue
,
models:
true
do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
(
:milestone
)
}
it
{
is_expected
.
to
have_many
(
:assignees
)
}
end
describe
'modules'
do
...
...
@@ -37,6 +38,24 @@ describe Issue, models: true do
end
end
describe
'#card_attributes'
do
it
'includes the author name'
do
allow
(
subject
).
to
receive
(
:author
).
and_return
(
double
(
name:
'Robert'
))
allow
(
subject
).
to
receive
(
:assignees
).
and_return
([])
expect
(
subject
.
card_attributes
).
to
eq
({
'Author'
=>
'Robert'
,
'Assignee'
=>
''
})
end
it
'includes the assignee name'
do
allow
(
subject
).
to
receive
(
:author
).
and_return
(
double
(
name:
'Robert'
))
allow
(
subject
).
to
receive
(
:assignees
).
and_return
([
double
(
name:
'Douwe'
)])
expect
(
subject
.
card_attributes
).
to
eq
({
'Author'
=>
'Robert'
,
'Assignee'
=>
'Douwe'
})
end
end
describe
'#closed_at'
do
after
do
Timecop
.
return
...
...
spec/models/merge_request_spec.rb
View file @
799459c3
...
...
@@ -9,6 +9,7 @@ describe MergeRequest, models: true do
it
{
is_expected
.
to
belong_to
(
:target_project
).
class_name
(
'Project'
)
}
it
{
is_expected
.
to
belong_to
(
:source_project
).
class_name
(
'Project'
)
}
it
{
is_expected
.
to
belong_to
(
:merge_user
).
class_name
(
"User"
)
}
it
{
is_expected
.
to
belong_to
(
:assignee
)
}
it
{
is_expected
.
to
have_many
(
:merge_request_diffs
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:approver_groups
).
dependent
(
:destroy
)
}
end
...
...
@@ -87,6 +88,24 @@ describe MergeRequest, models: true do
end
end
describe
'#card_attributes'
do
it
'includes the author name'
do
allow
(
subject
).
to
receive
(
:author
).
and_return
(
double
(
name:
'Robert'
))
allow
(
subject
).
to
receive
(
:assignee
).
and_return
(
nil
)
expect
(
subject
.
card_attributes
).
to
eq
({
'Author'
=>
'Robert'
,
'Assignee'
=>
nil
})
end
it
'includes the assignee name'
do
allow
(
subject
).
to
receive
(
:author
).
and_return
(
double
(
name:
'Robert'
))
allow
(
subject
).
to
receive
(
:assignee
).
and_return
(
double
(
name:
'Douwe'
))
expect
(
subject
.
card_attributes
).
to
eq
({
'Author'
=>
'Robert'
,
'Assignee'
=>
'Douwe'
})
end
end
describe
'#assignee_or_author?'
do
let
(
:user
)
{
create
(
:user
)
}
...
...
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