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
bf9dd432
Commit
bf9dd432
authored
Jun 10, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature specs for default dashboard preference
parent
1eb9a02f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
10 deletions
+54
-10
app/views/profiles/preferences/show.html.haml
app/views/profiles/preferences/show.html.haml
+1
-1
app/views/profiles/preferences/update.js.erb
app/views/profiles/preferences/update.js.erb
+5
-0
spec/features/profiles/preferences_spec.rb
spec/features/profiles/preferences_spec.rb
+48
-9
No files found.
app/views/profiles/preferences/show.html.haml
View file @
bf9dd432
...
...
@@ -33,7 +33,7 @@
Behavior
.panel-body
.form-group
=
f
.
label
:dashboard
,
class:
'control-label'
=
f
.
label
:dashboard
,
'Default Dashboard'
,
class:
'control-label'
.col-sm-10
=
f
.
select
:dashboard
,
dashboard_choices
,
{},
class:
'form-control'
%p
.help-block.hint
...
...
app/views/profiles/preferences/update.js.erb
View file @
bf9dd432
// Remove body class for any previous theme, re-add current one
$('body').removeClass('
<%=
Gitlab
::
Themes
.
body_classes
%>
')
$('body').addClass('
<%=
user_application_theme
%>
')
// Re-enable the "Save" button
$('input[type=submit]').enable()
// Show the notice flash message
new Flash('
<%=
flash
.
discard
(
:notice
)
%>
', 'notice')
spec/features/profiles/preferences_spec.rb
View file @
bf9dd432
...
...
@@ -5,22 +5,25 @@ describe 'Profile > Preferences' do
before
do
login_as
(
user
)
visit
profile_preferences_path
end
describe
'User changes their application theme'
,
js:
true
do
let
(
:default
)
{
Gitlab
::
Themes
.
default
}
let
(
:theme
)
{
Gitlab
::
Themes
.
by_id
(
5
)
}
before
do
visit
profile_preferences_path
it
'creates a flash message'
do
choose
"user_theme_id_
#{
theme
.
id
}
"
expect_preferences_saved_message
end
it
'
creates a flash messag
e'
do
it
'
updates their preferenc
e'
do
choose
"user_theme_id_
#{
theme
.
id
}
"
within
(
'.flash-container'
)
do
expect
(
page
).
to
have_content
(
'Preferences saved.'
)
e
nd
visit
page
.
current_path
e
xpect
(
page
).
to
have_checked_field
(
"user_theme_id_
#{
theme
.
id
}
"
)
end
it
'reflects the changes immediately'
do
...
...
@@ -33,9 +36,45 @@ describe 'Profile > Preferences' do
end
end
describe
'User changes their syntax highlighting theme'
do
before
do
visit
profile_preferences_path
describe
'User changes their syntax highlighting theme'
,
js:
true
do
it
'creates a flash message'
do
choose
'user_color_scheme_id_5'
expect_preferences_saved_message
end
it
'updates their preference'
do
choose
'user_color_scheme_id_5'
visit
page
.
current_path
expect
(
page
).
to
have_checked_field
(
'user_color_scheme_id_5'
)
end
end
describe
'User changes their default dashboard'
do
it
'creates a flash message'
do
select
'Starred Projects'
,
from:
'user_dashboard'
click_button
'Save'
expect_preferences_saved_message
end
it
'updates their preference'
do
select
'Starred Projects'
,
from:
'user_dashboard'
click_button
'Save'
click_link
'Dashboard'
expect
(
page
.
current_path
).
to
eq
starred_dashboard_projects_path
click_link
'Your Projects'
expect
(
page
.
current_path
).
to
eq
dashboard_path
end
end
def
expect_preferences_saved_message
within
(
'.flash-container'
)
do
expect
(
page
).
to
have_content
(
'Preferences saved.'
)
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