BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
bee28e17
Commit
bee28e17
authored
Apr 11, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Requires user to be signed in when changing notification settings
parent
93a10f17
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
0 deletions
+52
-0
notification_settings_controller.rb
app/controllers/groups/notification_settings_controller.rb
+2
-0
notification_settings_controller.rb
app/controllers/projects/notification_settings_controller.rb
+2
-0
notification_settings_controller_spec.rb
...ntrollers/groups/notification_settings_controller_spec.rb
+17
-0
notification_settings_controller_spec.rb
...rollers/projects/notification_settings_controller_spec.rb
+31
-0
No files found.
app/controllers/groups/notification_settings_controller.rb
View file @
bee28e17
class
Groups
::
NotificationSettingsController
<
Groups
::
ApplicationController
before_action
:authenticate_user!
def
update
notification_setting
=
current_user
.
notification_settings_for
(
group
)
saved
=
notification_setting
.
update_attributes
(
notification_setting_params
)
...
...
app/controllers/projects/notification_settings_controller.rb
View file @
bee28e17
class
Projects
::
NotificationSettingsController
<
Projects
::
ApplicationController
before_action
:authenticate_user!
def
create
notification_setting
=
current_user
.
notification_settings_for
(
project
)
saved
=
notification_setting
.
update_attributes
(
notification_setting_params
)
...
...
spec/controllers/groups/notification_settings_controller_spec.rb
0 → 100644
View file @
bee28e17
require
'spec_helper'
describe
Groups
::
NotificationSettingsController
do
let
(
:group
)
{
create
(
:group
)
}
describe
'#update'
do
context
'when not authorized'
do
it
'redirects to sign in page'
do
put
:update
,
group_id:
group
.
to_param
,
notification_setting:
{
level:
NotificationSetting
.
levels
[
:participating
]
}
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
end
end
end
spec/controllers/projects/notification_settings_controller_spec.rb
0 → 100644
View file @
bee28e17
require
'spec_helper'
describe
Projects
::
NotificationSettingsController
do
let
(
:project
)
{
create
(
:empty_project
)
}
describe
'#create'
do
context
'when not authorized'
do
it
'redirects to sign in page'
do
post
:create
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
notification_setting:
{
level:
NotificationSetting
.
levels
[
:participating
]
}
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
end
end
describe
'#update'
do
context
'when not authorized'
do
it
'redirects to sign in page'
do
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
notification_setting:
{
level:
NotificationSetting
.
levels
[
:participating
]
}
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
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