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
e9de5694
Commit
e9de5694
authored
Jun 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests for user page
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
72b29525
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
18 deletions
+22
-18
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+1
-1
app/models/user.rb
app/models/user.rb
+4
-0
features/steps/shared/project.rb
features/steps/shared/project.rb
+6
-6
features/user.feature
features/user.feature
+11
-11
No files found.
app/controllers/users_controller.rb
View file @
e9de5694
...
...
@@ -6,7 +6,7 @@ class UsersController < ApplicationController
@user
=
User
.
find_by_username!
(
params
[
:username
])
@projects
=
Project
.
personal
(
@user
).
accessible_to
(
current_user
)
if
!
current_user
&&
@projects
.
empty
?
unless
current_user
||
@user
.
public_profile
?
return
authenticate_user!
end
...
...
app/models/user.rb
View file @
e9de5694
...
...
@@ -478,4 +478,8 @@ class User < ActiveRecord::Base
def
generate_tmp_oauth_email
self
.
email
=
"temp-email-for-oauth-
#{
username
}
@gitlab.localhost"
end
def
public_profile?
authorized_projects
.
public_only
.
any?
end
end
features/steps/shared/project.rb
View file @
e9de5694
...
...
@@ -102,24 +102,24 @@ module SharedProject
page
.
should_not
have_content
"Community"
end
step
'"John Doe"
is authorized to
private project "Enterprise"'
do
step
'"John Doe"
owns
private project "Enterprise"'
do
user
=
user_exists
(
"John Doe"
,
username:
"john_doe"
)
project
=
Project
.
find_by
(
name:
"Enterprise"
)
project
||=
create
(
:project
,
name:
"Enterprise"
,
namespace:
user
.
namespace
)
project
||=
create
(
:
empty_
project
,
name:
"Enterprise"
,
namespace:
user
.
namespace
)
project
.
team
<<
[
user
,
:master
]
end
step
'"John Doe"
is authorized to
internal project "Internal"'
do
step
'"John Doe"
owns
internal project "Internal"'
do
user
=
user_exists
(
"John Doe"
,
username:
"john_doe"
)
project
=
Project
.
find_by
(
name:
"Internal"
)
project
||=
create
:
project
,
:internal
,
name:
'Internal'
project
||=
create
:
empty_project
,
:internal
,
name:
'Internal'
,
namespace:
user
.
namespace
project
.
team
<<
[
user
,
:master
]
end
step
'"John Doe"
is authorized to
public project "Community"'
do
step
'"John Doe"
owns
public project "Community"'
do
user
=
user_exists
(
"John Doe"
,
username:
"john_doe"
)
project
=
Project
.
find_by
(
name:
"Community"
)
project
||=
create
:
project
,
:public
,
name:
'Community'
project
||=
create
:
empty_project
,
:public
,
name:
'Community'
,
namespace:
user
.
namespace
project
.
team
<<
[
user
,
:master
]
end
end
features/user.feature
View file @
e9de5694
Feature
:
User
Background
:
Given
User
"John Doe"
exists
And
"John Doe"
is authorized to
private project
"Enterprise"
And
"John Doe"
owns
private project
"Enterprise"
# Signed out
Scenario
:
I
visit user
"John Doe"
page while not signed in when he
is authorized to
a public project
Given
"John Doe"
is authorized to
internal project
"Internal"
And
"John Doe"
is authorized to
public project
"Community"
Scenario
:
I
visit user
"John Doe"
page while not signed in when he
owns
a public project
Given
"John Doe"
owns
internal project
"Internal"
And
"John Doe"
owns
public project
"Community"
When
I visit user
"John Doe"
page
Then
I should see user
"John Doe"
page
And
I should not see project
"Enterprise"
...
...
@@ -15,15 +15,15 @@ Feature: User
And
I should see project
"Community"
Scenario
:
I
visit user
"John Doe"
page while not signed in when he is not authorized to a public project
Given
"John Doe"
is authorized to
internal project
"Internal"
Given
"John Doe"
owns
internal project
"Internal"
When
I visit user
"John Doe"
page
Then
I should be redirected to sign in page
# Signed in as someone else
Scenario
:
I
visit user
"John Doe"
page while signed in as someone else when he
is authorized to
a public project
Given
"John Doe"
is authorized to
public project
"Community"
And
"John Doe"
is authorized to
internal project
"Internal"
Scenario
:
I
visit user
"John Doe"
page while signed in as someone else when he
owns
a public project
Given
"John Doe"
owns
public project
"Community"
And
"John Doe"
owns
internal project
"Internal"
And
I sign in as a user
When
I visit user
"John Doe"
page
Then
I should see user
"John Doe"
page
...
...
@@ -32,7 +32,7 @@ Feature: User
And
I should see project
"Community"
Scenario
:
I
visit user
"John Doe"
page while signed in as someone else when he is not authorized to a public project
Given
"John Doe"
is authorized to
internal project
"Internal"
Given
"John Doe"
owns
internal project
"Internal"
And
I sign in as a user
When
I visit user
"John Doe"
page
Then
I should see user
"John Doe"
page
...
...
@@ -51,8 +51,8 @@ Feature: User
# Signed in as the user himself
Scenario
:
I
visit user
"John Doe"
page while signed in as
"John Doe"
when he has a public project
Given
"John Doe"
is authorized to
internal project
"Internal"
And
"John Doe"
is authorized to
public project
"Community"
Given
"John Doe"
owns
internal project
"Internal"
And
"John Doe"
owns
public project
"Community"
And
I sign in as
"John Doe"
When
I visit user
"John Doe"
page
Then
I should see user
"John Doe"
page
...
...
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