BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f76f5059
Commit
f76f5059
authored
Mar 21, 2017
by
Stan Hu
Committed by
Lin Jen-Shin
Mar 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'rs-issue-29592' into 'master'
Handle Route#name being nil after an update Closes #29592 See merge request !10102
parent
aab54d75
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
route.rb
app/models/route.rb
+1
-1
route_spec.rb
spec/models/route_spec.rb
+10
-2
No files found.
app/models/route.rb
View file @
f76f5059
...
...
@@ -21,7 +21,7 @@ class Route < ActiveRecord::Base
attributes
[
:path
]
=
route
.
path
.
sub
(
path_was
,
path
)
end
if
name_changed?
&&
route
.
name
.
present?
if
name_changed?
&&
name_was
.
present?
&&
route
.
name
.
present?
attributes
[
:name
]
=
route
.
name
.
sub
(
name_was
,
name
)
end
...
...
spec/models/route_spec.rb
View file @
f76f5059
...
...
@@ -43,14 +43,22 @@ describe Route, models: true do
end
context
'name update'
do
before
{
route
.
update_attributes
(
name:
'bar'
)
}
it
"updates children routes with new path"
do
route
.
update_attributes
(
name:
'bar'
)
expect
(
described_class
.
exists?
(
name:
'bar'
)).
to
be_truthy
expect
(
described_class
.
exists?
(
name:
'bar / test'
)).
to
be_truthy
expect
(
described_class
.
exists?
(
name:
'bar / test / foo'
)).
to
be_truthy
expect
(
described_class
.
exists?
(
name:
'gitlab-org'
)).
to
be_truthy
end
it
'handles a rename from nil'
do
# Note: using `update_columns` to skip all validation and callbacks
route
.
update_columns
(
name:
nil
)
expect
{
route
.
update_attributes
(
name:
'bar'
)
}
.
to
change
{
route
.
name
}.
from
(
nil
).
to
(
'bar'
)
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