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
2d68f1fb
Commit
2d68f1fb
authored
Mar 17, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevented Issues CSV export failing when author is nil
parent
d111b146
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+1
-0
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+28
-0
spec/services/issues/export_csv_service_spec.rb
spec/services/issues/export_csv_service_spec.rb
+8
-0
No files found.
app/models/concerns/issuable.rb
View file @
2d68f1fb
...
...
@@ -49,6 +49,7 @@ module Issuable
delegate
:name
,
:email
,
to: :author
,
allow_nil:
true
,
prefix:
true
delegate
:name
,
...
...
spec/models/concerns/issuable_spec.rb
View file @
2d68f1fb
...
...
@@ -44,6 +44,34 @@ describe Issue, "Issuable" do
it
{
expect
(
described_class
).
to
respond_to
(
:assigned
)
}
end
describe
'author_name'
do
it
'is delegated to author'
do
expect
(
issue
.
author_name
).
to
eq
issue
.
author
.
name
end
it
'returns nil when author is nil'
do
issue
.
author_id
=
nil
issue
.
save
(
validate:
false
)
expect
(
issue
.
author_name
).
to
eq
nil
end
end
describe
'assignee_name'
do
it
'is delegated to assignee'
do
issue
.
update!
(
assignee:
create
(
:user
))
expect
(
issue
.
assignee_name
).
to
eq
issue
.
assignee
.
name
end
it
'returns nil when assignee is nil'
do
issue
.
assignee_id
=
nil
issue
.
save
(
validate:
false
)
expect
(
issue
.
assignee_name
).
to
eq
nil
end
end
describe
"before_save"
do
describe
"#update_cache_counts"
do
context
"when previous assignee exists"
do
...
...
spec/services/issues/export_csv_service_spec.rb
View file @
2d68f1fb
...
...
@@ -108,4 +108,12 @@ describe Issues::ExportCsvService, services: true do
expect
(
csv
[
0
][
'Labels'
]).
to
eq
nil
end
end
it
'succeeds when author is non-existent'
do
issue
.
author_id
=
99999999
issue
.
save
(
validate:
false
)
expect
(
csv
[
0
][
'Author'
]).
to
eq
nil
expect
(
csv
[
0
][
'Author Username'
]).
to
eq
nil
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