diff options
Diffstat (limited to 'spec/helpers/user_callouts_helper_spec.rb')
-rw-r--r-- | spec/helpers/user_callouts_helper_spec.rb | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/spec/helpers/user_callouts_helper_spec.rb b/spec/helpers/user_callouts_helper_spec.rb index 60238053aa2..6f1f358af83 100644 --- a/spec/helpers/user_callouts_helper_spec.rb +++ b/spec/helpers/user_callouts_helper_spec.rb @@ -25,7 +25,21 @@ RSpec.describe UserCalloutsHelper do allow(helper).to receive(:user_dismissed?).and_return(false) end - it { is_expected.to be true } + context 'when active_nav_link is in the operations section' do + before do + allow(helper).to receive(:active_nav_link?).and_return(true) + end + + it { is_expected.to be true } + end + + context 'when active_nav_link is not in the operations section' do + before do + allow(helper).to receive(:active_nav_link?).and_return(false) + end + + it { is_expected.to be false } + end end context 'when user dismissed' do @@ -67,6 +81,36 @@ RSpec.describe UserCalloutsHelper do end end + describe '.show_customize_homepage_banner?' do + let(:customize_homepage) { true } + + subject { helper.show_customize_homepage_banner?(customize_homepage) } + + context 'when user has not dismissed' do + before do + allow(helper).to receive(:user_dismissed?).with(described_class::CUSTOMIZE_HOMEPAGE) { false } + end + + context 'when customize_homepage is set' do + it { is_expected.to be true } + end + + context 'when customize_homepage is false' do + let(:customize_homepage) { false } + + it { is_expected.to be false } + end + end + + context 'when user dismissed' do + before do + allow(helper).to receive(:user_dismissed?).with(described_class::CUSTOMIZE_HOMEPAGE) { true } + end + + it { is_expected.to be false } + end + end + describe '.render_flash_user_callout' do it 'renders the flash_user_callout partial' do expect(helper).to receive(:render) |