2016-02-27 01:28:08 +11:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-04-10 01:11:37 +10:00
|
|
|
describe ApplicationHelper do
|
|
|
|
describe 'active_nav_class' do
|
|
|
|
it 'returns active when on the current page' do
|
|
|
|
allow(helper).to receive(:current_page?).and_return(true)
|
2016-02-27 01:28:08 +11:00
|
|
|
|
2017-04-10 01:11:37 +10:00
|
|
|
result = helper.active_nav_class("/test")
|
|
|
|
expect(result).to eq "active"
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns empty string when not on current page' do
|
|
|
|
allow(helper).to receive(:current_page?).and_return(false)
|
|
|
|
|
|
|
|
result = helper.active_nav_class("/test")
|
|
|
|
expect(result).to eq ""
|
|
|
|
end
|
|
|
|
end
|
2017-04-16 11:40:33 +10:00
|
|
|
|
|
|
|
describe 'show_landing_strip?', without_verify_partial_doubles: true do
|
|
|
|
describe 'when signed in' do
|
|
|
|
before do
|
|
|
|
allow(helper).to receive(:user_signed_in?).and_return(true)
|
|
|
|
end
|
|
|
|
it 'does not show landing strip' do
|
|
|
|
expect(helper.show_landing_strip?).to eq false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when signed out' do
|
|
|
|
before do
|
|
|
|
allow(helper).to receive(:user_signed_in?).and_return(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show landing strip on single user instance' do
|
|
|
|
allow(helper).to receive(:single_user_mode?).and_return(true)
|
|
|
|
|
|
|
|
expect(helper.show_landing_strip?).to eq false
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows landing strip on multi user instance' do
|
|
|
|
allow(helper).to receive(:single_user_mode?).and_return(false)
|
|
|
|
|
|
|
|
expect(helper.show_landing_strip?).to eq true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-02-27 01:28:08 +11:00
|
|
|
end
|