Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Mastodon
Commits
dff576b7
Commit
dff576b7
authored
7 years ago
by
Akihiko Odaki
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Cover ApplicationHelper more (#3412)
parent
52ae83d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/helpers/application_helper_spec.rb
+61
-0
61 additions, 0 deletions
spec/helpers/application_helper_spec.rb
with
61 additions
and
0 deletions
spec/helpers/application_helper_spec.rb
+
61
−
0
View file @
dff576b7
...
...
@@ -17,6 +17,59 @@ describe ApplicationHelper do
end
end
describe
'add_rtl_body_class'
do
it
'adds rtl body class if locale is Arabic'
do
I18n
.
locale
=
:ar
expect
(
helper
.
add_rtl_body_class
(
'other classes'
)).
to
eq
'other classes rtl'
end
it
'adds rtl body class if locale is Farsi'
do
I18n
.
locale
=
:fa
expect
(
helper
.
add_rtl_body_class
(
'other classes'
)).
to
eq
'other classes rtl'
end
it
'adds rtl if locale is Hebrew'
do
I18n
.
locale
=
:he
expect
(
helper
.
add_rtl_body_class
(
'other classes'
)).
to
eq
'other classes rtl'
end
it
'does not add rtl if locale is Thai'
do
I18n
.
locale
=
:th
expect
(
helper
.
add_rtl_body_class
(
'other classes'
)).
to
eq
'other classes'
end
end
describe
'fa_icon'
do
it
'returns a tag of fixed-width cog'
do
expect
(
helper
.
fa_icon
(
'cog fw'
)).
to
eq
'<i class="fa fa-cog fa-fw"></i>'
end
end
describe
'favicon_path'
do
it
'returns /favicon.ico on production enviromnent'
do
expect
(
Rails
.
env
).
to
receive
(
:production?
).
and_return
(
true
)
expect
(
helper
.
favicon_path
).
to
eq
'/favicon.ico'
end
end
describe
'open_registrations?'
do
it
'returns true when open for registrations'
do
without_partial_double_verification
do
expect
(
Setting
).
to
receive
(
:open_registrations
).
and_return
(
true
)
end
expect
(
helper
.
open_registrations?
).
to
eq
true
end
it
'returns false when closed for registrations'
do
without_partial_double_verification
do
expect
(
Setting
).
to
receive
(
:open_registrations
).
and_return
(
false
)
end
expect
(
helper
.
open_registrations?
).
to
eq
false
end
end
describe
'show_landing_strip?'
,
without_verify_partial_doubles:
true
do
describe
'when signed in'
do
before
do
...
...
@@ -45,4 +98,12 @@ describe ApplicationHelper do
end
end
end
describe
'title'
do
it
'returns site title on production enviroment'
do
Setting
.
site_title
=
'site title'
expect
(
Rails
.
env
).
to
receive
(
:production?
).
and_return
(
true
)
expect
(
helper
.
title
).
to
eq
'site title'
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment