diff options
author | Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> | 2017-05-30 01:03:37 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-29 18:03:37 +0200 |
commit | dff576b75d11335b3c424b399499c6b1edb4b626 (patch) | |
tree | 8382e9bff0b0497a57a67d450f2e13d9d24e5b90 /spec/helpers | |
parent | 52ae83d00862eebe0a79389b1808c034998a1584 (diff) |
Cover ApplicationHelper more (#3412)
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 81f38d0b0..a3903464b 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -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 |