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
311d648f
Commit
311d648f
authored
Feb 06, 2019
by
Fabian Schneider
Committed by
Toon Claes
Feb 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for preferences_helper
parent
050ee738
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+4
-4
spec/helpers/preferences_helper_spec.rb
spec/helpers/preferences_helper_spec.rb
+24
-0
No files found.
app/helpers/preferences_helper.rb
View file @
311d648f
...
...
@@ -50,10 +50,6 @@ module PreferencesHelper
]
end
def
default_first_day_of_week
first_day_of_week_choices
.
rassoc
(
Gitlab
::
CurrentSettings
.
first_day_of_week
).
first
end
def
first_day_of_week_choices_with_default
first_day_of_week_choices
.
unshift
([
_
(
'System default (%{default})'
)
%
{
default:
default_first_day_of_week
},
nil
])
end
...
...
@@ -81,6 +77,10 @@ module PreferencesHelper
def
excluded_dashboard_choices
[
'operations'
]
end
def
default_first_day_of_week
first_day_of_week_choices
.
rassoc
(
Gitlab
::
CurrentSettings
.
first_day_of_week
).
first
end
end
PreferencesHelper
.
prepend
(
EE
::
PreferencesHelper
)
spec/helpers/preferences_helper_spec.rb
View file @
311d648f
...
...
@@ -35,6 +35,30 @@ describe PreferencesHelper do
end
end
describe
'#first_day_of_week_choices'
do
it
'returns Sunday and Monday as choices'
do
expect
(
helper
.
first_day_of_week_choices
).
to
eq
[
[
'Sunday'
,
0
],
[
'Monday'
,
1
]
]
end
end
describe
'#first_day_of_week_choices_with_default'
do
it
'returns choices including system default'
do
expect
(
helper
.
first_day_of_week_choices_with_default
).
to
eq
[
[
'System default (Sunday)'
,
nil
],
[
'Sunday'
,
0
],
[
'Monday'
,
1
]
]
end
it
'returns choices including system default set to Monday'
do
stub_application_setting
(
first_day_of_week:
1
)
expect
(
helper
.
first_day_of_week_choices_with_default
).
to
eq
[
[
'System default (Monday)'
,
nil
],
[
'Sunday'
,
0
],
[
'Monday'
,
1
]
]
end
end
describe
'#user_application_theme'
do
context
'with a user'
do
it
"returns user's theme's css_class"
do
...
...
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