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
iv
gitlab-ce
Commits
00290b92
Commit
00290b92
authored
Oct 21, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test cov
parent
72d15cc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
25 deletions
+29
-25
app/controllers/team_members_controller.rb
app/controllers/team_members_controller.rb
+7
-21
spec/requests/team_members_spec.rb
spec/requests/team_members_spec.rb
+22
-4
No files found.
app/controllers/team_members_controller.rb
View file @
00290b92
...
@@ -8,35 +8,16 @@ class TeamMembersController < ApplicationController
...
@@ -8,35 +8,16 @@ class TeamMembersController < ApplicationController
def
show
def
show
@team_member
=
project
.
users_projects
.
find
(
params
[
:id
])
@team_member
=
project
.
users_projects
.
find
(
params
[
:id
])
respond_to
do
|
format
|
format
.
html
# show.html.erb
format
.
js
end
end
end
def
new
def
new
@team_member
=
project
.
users_projects
.
new
@team_member
=
project
.
users_projects
.
new
respond_to
do
|
format
|
format
.
html
# new.html.erb
format
.
js
end
end
end
def
create
def
create
@team_member
=
UsersProject
.
new
(
params
[
:team_member
])
@team_member
=
UsersProject
.
new
(
params
[
:team_member
])
@team_member
.
project
=
project
@team_member
.
project
=
project
@team_member
.
save
respond_to
do
|
format
|
if
@team_member
.
save
format
.
html
{
redirect_to
@team_member
,
notice:
'Team member was successfully created.'
}
format
.
js
else
format
.
html
{
render
action:
"new"
}
format
.
js
end
end
end
end
def
update
def
update
...
@@ -45,7 +26,12 @@ class TeamMembersController < ApplicationController
...
@@ -45,7 +26,12 @@ class TeamMembersController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
js
format
.
js
format
.
html
{
redirect_to
team_project_path
(
@project
)}
format
.
html
do
unless
@team_member
.
valid?
flash
[
:alert
]
=
"User should have at least one role"
end
redirect_to
team_project_path
(
@project
)
end
end
end
end
end
...
...
spec/requests/team_members_spec.rb
View file @
00290b92
...
@@ -29,19 +29,37 @@ describe "TeamMembers" do
...
@@ -29,19 +29,37 @@ describe "TeamMembers" do
describe
"fill in"
do
describe
"fill in"
do
before
do
before
do
check
"team_member_read"
click_link
"Select user"
click_link
"Select user"
click_link
@user_1
.
name
click_link
@user_1
.
name
#select @user_1.name, :from => "team_member_user_id"
within
"#team_member_new"
do
check
"team_member_read"
check
"team_member_write"
end
end
end
it
{
expect
{
click_button
"Save"
}.
to
change
{
UsersProject
.
count
}.
by
(
1
)
}
it
{
expect
{
click_button
"Save"
;
sleep
(
1
)
}.
to
change
{
UsersProject
.
count
}.
by
(
1
)
}
it
"should add new member to table"
do
it
"should add new member to table"
do
click_button
"Save"
click_button
"Save"
@member
=
UsersProject
.
last
page
.
should_not
have_content
(
"Add new member"
)
page
.
should
have_content
@user_1
.
name
page
.
should
have_content
@user_1
.
name
@member
.
read
.
should
be_true
@member
.
write
.
should
be_true
@member
.
admin
.
should
be_false
end
it
"should not allow creation without access selected"
do
within
"#team_member_new"
do
uncheck
"team_member_read"
uncheck
"team_member_write"
uncheck
"team_member_admin"
end
expect
{
click_button
"Save"
}.
to_not
change
{
UsersProject
.
count
}
page
.
should
have_content
(
"Please choose at least one Role in the Access list"
)
end
end
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