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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
aabb466e
Commit
aabb466e
authored
Apr 11, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs for group/project notification controller
parent
ef22b76b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
3 deletions
+53
-3
spec/controllers/groups/notification_settings_controller_spec.rb
...ntrollers/groups/notification_settings_controller_spec.rb
+16
-1
spec/controllers/projects/notification_settings_controller_spec.rb
...rollers/projects/notification_settings_controller_spec.rb
+37
-2
No files found.
spec/controllers/groups/notification_settings_controller_spec.rb
View file @
aabb466e
...
@@ -2,16 +2,31 @@ require 'spec_helper'
...
@@ -2,16 +2,31 @@ require 'spec_helper'
describe
Groups
::
NotificationSettingsController
do
describe
Groups
::
NotificationSettingsController
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
'#update'
do
describe
'#update'
do
context
'when not authorized'
do
context
'when not authorized'
do
it
'redirects to sign in page'
do
it
'redirects to sign in page'
do
put
:update
,
put
:update
,
group_id:
group
.
to_param
,
group_id:
group
.
to_param
,
notification_setting:
{
level:
NotificationSetting
.
levels
[
:participating
]
}
notification_setting:
{
level:
:participating
}
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
end
end
end
context
'when authorized'
do
before
do
sign_in
(
user
)
end
it
'returns success'
do
put
:update
,
group_id:
group
.
to_param
,
notification_setting:
{
level: :participating
}
expect
(
response
.
status
).
to
eq
200
end
end
end
end
end
end
spec/controllers/projects/notification_settings_controller_spec.rb
View file @
aabb466e
...
@@ -2,6 +2,11 @@ require 'spec_helper'
...
@@ -2,6 +2,11 @@ require 'spec_helper'
describe
Projects
::
NotificationSettingsController
do
describe
Projects
::
NotificationSettingsController
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
team
<<
[
user
,
:developer
]
end
describe
'#create'
do
describe
'#create'
do
context
'when not authorized'
do
context
'when not authorized'
do
...
@@ -9,11 +14,26 @@ describe Projects::NotificationSettingsController do
...
@@ -9,11 +14,26 @@ describe Projects::NotificationSettingsController do
post
:create
,
post
:create
,
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
project_id:
project
.
to_param
,
notification_setting:
{
level:
NotificationSetting
.
levels
[
:participating
]
}
notification_setting:
{
level:
:participating
}
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
end
end
end
context
'when authorized'
do
before
do
sign_in
(
user
)
end
it
'returns success'
do
post
:create
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
notification_setting:
{
level: :participating
}
expect
(
response
.
status
).
to
eq
200
end
end
end
end
describe
'#update'
do
describe
'#update'
do
...
@@ -22,10 +42,25 @@ describe Projects::NotificationSettingsController do
...
@@ -22,10 +42,25 @@ describe Projects::NotificationSettingsController do
put
:update
,
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
project_id:
project
.
to_param
,
notification_setting:
{
level:
NotificationSetting
.
levels
[
:participating
]
}
notification_setting:
{
level:
:participating
}
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
end
end
end
context
'when authorized'
do
before
do
sign_in
(
user
)
end
it
'returns success'
do
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
notification_setting:
{
level: :participating
}
expect
(
response
.
status
).
to
eq
200
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