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
Léo-Paul Géneau
gitlab-ce
Commits
fb470e8e
Commit
fb470e8e
authored
Jan 07, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate username uniq in scope of namespace
parent
a0bd09ab
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
12 deletions
+18
-12
app/models/user.rb
app/models/user.rb
+8
-0
app/views/profiles/account.html.haml
app/views/profiles/account.html.haml
+1
-1
features/steps/project/project_milestones.rb
features/steps/project/project_milestones.rb
+4
-4
lib/tasks/travis.rake
lib/tasks/travis.rake
+5
-7
No files found.
app/models/user.rb
View file @
fb470e8e
...
...
@@ -67,6 +67,8 @@ class User < ActiveRecord::Base
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
validate
:namespace_uniq
,
if:
->
(
user
)
{
user
.
username_changed?
}
before_validation
:generate_password
,
on: :create
before_save
:ensure_authentication_token
alias_attribute
:private_token
,
:authentication_token
...
...
@@ -135,6 +137,12 @@ class User < ActiveRecord::Base
end
end
def
namespace_uniq
namespace_name
=
self
.
username
if
Namespace
.
find_by_path
(
namespace_name
)
self
.
errors
.
add
:username
,
"already exist"
end
end
# Namespaces user has access to
def
namespaces
...
...
app/views/profiles/account.html.haml
View file @
fb470e8e
...
...
@@ -69,7 +69,7 @@
%i
.icon-ok
Saved
%span
.update-failed.cred.hide
%i
.icon-
ok
%i
.icon-
remove
Failed
%ul
.cred
%li
It will change web url for personal projects.
...
...
features/steps/project/project_milestones.rb
View file @
fb470e8e
...
...
@@ -50,12 +50,12 @@ class ProjectMilestones < Spinach::FeatureSteps
end
Then
"I should see 3 issues"
do
page
.
should
have_selector
(
'.milestone-issue-filter li'
,
count:
4
)
page
.
should
have_selector
(
'.milestone-issue-filter li.hide'
,
count:
1
)
page
.
should
have_selector
(
'.milestone-issue-filter
.well-list
li'
,
count:
4
)
page
.
should
have_selector
(
'.milestone-issue-filter
.well-list
li.hide'
,
count:
1
)
end
Then
"I should see 4 issues"
do
page
.
should
have_selector
(
'.milestone-issue-filter li'
,
count:
4
)
page
.
should_not
have_selector
(
'.milestone-issue-filter li.hide'
)
page
.
should
have_selector
(
'.milestone-issue-filter
.well-list
li'
,
count:
4
)
page
.
should_not
have_selector
(
'.milestone-issue-filter
.well-list
li.hide'
)
end
end
lib/tasks/travis.rake
View file @
fb470e8e
task
:travis
do
[
"rake spinach"
,
"rake spec"
].
each
do
|
cmd
|
puts
"Starting to run
#{
cmd
}
..."
system
(
"export DISPLAY=:99.0 && bundle exec
#{
cmd
}
"
)
raise
"
#{
cmd
}
failed!"
unless
$?
.
exitstatus
==
0
end
end
desc
"Travis run tests"
task
:travis
=>
[
:spinach
,
:spec
]
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