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
0e2c96e7
Commit
0e2c96e7
authored
Feb 03, 2017
by
Richard Macklin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `let` in Profiles::NotificationsController spec
parent
4647d138
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
spec/controllers/profiles/notifications_controller_spec.rb
spec/controllers/profiles/notifications_controller_spec.rb
+9
-12
No files found.
spec/controllers/profiles/notifications_controller_spec.rb
View file @
0e2c96e7
require
'spec_helper'
require
'spec_helper'
describe
Profiles
::
NotificationsController
do
describe
Profiles
::
NotificationsController
do
let
(
:user
)
do
create
(
:user
)
do
|
user
|
user
.
emails
.
create
(
email:
'original@example.com'
)
user
.
emails
.
create
(
email:
'new@example.com'
)
user
.
update
(
notification_email:
'original@example.com'
)
user
.
save!
end
end
describe
'GET show'
do
describe
'GET show'
do
it
'renders'
do
it
'renders'
do
user
=
create_user
sign_in
(
user
)
sign_in
(
user
)
get
:show
get
:show
...
@@ -14,7 +22,6 @@ describe Profiles::NotificationsController do
...
@@ -14,7 +22,6 @@ describe Profiles::NotificationsController do
describe
'POST update'
do
describe
'POST update'
do
it
'updates only permitted attributes'
do
it
'updates only permitted attributes'
do
user
=
create_user
sign_in
(
user
)
sign_in
(
user
)
put
:update
,
user:
{
notification_email:
'new@example.com'
,
notified_of_own_activity:
true
,
admin:
true
}
put
:update
,
user:
{
notification_email:
'new@example.com'
,
notified_of_own_activity:
true
,
admin:
true
}
...
@@ -27,7 +34,6 @@ describe Profiles::NotificationsController do
...
@@ -27,7 +34,6 @@ describe Profiles::NotificationsController do
end
end
it
'shows an error message if the params are invalid'
do
it
'shows an error message if the params are invalid'
do
user
=
create_user
sign_in
(
user
)
sign_in
(
user
)
put
:update
,
user:
{
notification_email:
''
}
put
:update
,
user:
{
notification_email:
''
}
...
@@ -36,13 +42,4 @@ describe Profiles::NotificationsController do
...
@@ -36,13 +42,4 @@ describe Profiles::NotificationsController do
expect
(
controller
).
to
set_flash
[
:alert
].
to
(
'Failed to save new settings'
)
expect
(
controller
).
to
set_flash
[
:alert
].
to
(
'Failed to save new settings'
)
end
end
end
end
def
create_user
create
(
:user
)
do
|
user
|
user
.
emails
.
create
(
email:
'original@example.com'
)
user
.
emails
.
create
(
email:
'new@example.com'
)
user
.
update
(
notification_email:
'original@example.com'
)
user
.
save!
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