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
Tatuya Kamada
gitlab-ce
Commits
5d619ab8
Commit
5d619ab8
authored
Jan 16, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix typo, added relevant spec
parent
1028b111
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
db/migrate/20161226122833_remove_dot_git_from_usernames.rb
db/migrate/20161226122833_remove_dot_git_from_usernames.rb
+1
-1
spec/migrations/remove_dot_git_from_usernames_spec.rb
spec/migrations/remove_dot_git_from_usernames_spec.rb
+57
-0
No files found.
db/migrate/20161226122833_remove_dot_git_from_usernames.rb
View file @
5d619ab8
...
...
@@ -75,7 +75,7 @@ class RemoveDotGitFromUsernames < ActiveRecord::Migration
counter
+=
1
path
=
"
#{
base
}#{
counter
}
"
return
check_route
(
base
,
counter
,
path
)
return
check_route
s
(
base
,
counter
,
path
)
end
end
...
...
spec/migrations/remove_dot_git_from_usernames.rb
→
spec/migrations/remove_dot_git_from_usernames
_spec
.rb
View file @
5d619ab8
...
...
@@ -5,17 +5,11 @@ require Rails.root.join('db', 'migrate', '20161226122833_remove_dot_git_from_use
describe
RemoveDotGitFromUsernames
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:migration
)
{
described_class
.
new
}
describe
'#up'
do
let
(
:migration
)
{
described_class
.
new
}
before
do
namespace
=
user
.
namespace
namespace
.
path
=
'test.git'
namespace
.
save!
(
validate:
false
)
user
.
username
=
'test.git'
user
.
save!
(
validate:
false
)
update_namespace
(
user
,
'test.git'
)
end
it
'renames user with .git in username'
do
...
...
@@ -26,4 +20,38 @@ describe RemoveDotGitFromUsernames do
expect
(
user
.
namespace
.
route
.
path
).
to
eq
(
'test_git'
)
end
end
context
'when new path exists already'
do
describe
'#up'
do
let
(
:user2
)
{
create
(
:user
)
}
before
do
update_namespace
(
user
,
'test.git'
)
update_namespace
(
user2
,
'test_git'
)
storages
=
{
'default'
=>
'tmp/tests/custom_repositories'
}
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
allow
(
migration
).
to
receive
(
:route_exists?
).
with
(
'test_git'
).
and_return
(
true
)
allow
(
migration
).
to
receive
(
:route_exists?
).
with
(
'test_git1'
).
and_return
(
false
)
end
it
'renames user with .git in username'
do
migration
.
up
expect
(
user
.
reload
.
username
).
to
eq
(
'test_git1'
)
expect
(
user
.
namespace
.
reload
.
path
).
to
eq
(
'test_git1'
)
expect
(
user
.
namespace
.
route
.
path
).
to
eq
(
'test_git1'
)
end
end
end
def
update_namespace
(
user
,
path
)
namespace
=
user
.
namespace
namespace
.
path
=
path
namespace
.
save!
(
validate:
false
)
user
.
username
=
path
user
.
save!
(
validate:
false
)
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