diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/helpers/whats_new_helper_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'spec/helpers/whats_new_helper_spec.rb')
-rw-r--r-- | spec/helpers/whats_new_helper_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/helpers/whats_new_helper_spec.rb b/spec/helpers/whats_new_helper_spec.rb index db880163454..7d8fb236b1e 100644 --- a/spec/helpers/whats_new_helper_spec.rb +++ b/spec/helpers/whats_new_helper_spec.rb @@ -3,6 +3,52 @@ require 'spec_helper' RSpec.describe WhatsNewHelper do + describe '#whats_new_storage_key' do + subject { helper.whats_new_storage_key } + + before do + allow(helper).to receive(:whats_new_most_recent_release_items).and_return(json) + end + + context 'when recent release items exist' do + let(:json) { [{ release: 84.0 }].to_json } + + it { is_expected.to eq('display-whats-new-notification-84.0') } + + context 'when the release items are missing the release key' do + let(:json) { [{ title: 'bells!' }].to_json } + + it { is_expected.to eq('display-whats-new-notification') } + end + end + + context 'when recent release items do NOT exist' do + let(:json) { WhatsNewHelper::EMPTY_JSON } + + it { is_expected.to be_nil } + end + end + + describe '#whats_new_most_recent_release_items_count' do + subject { helper.whats_new_most_recent_release_items_count } + + before do + allow(helper).to receive(:whats_new_most_recent_release_items).and_return(json) + end + + context 'when recent release items exist' do + let(:json) { [:bells, :and, :whistles].to_json } + + it { is_expected.to eq(3) } + end + + context 'when recent release items do NOT exist' do + let(:json) { WhatsNewHelper::EMPTY_JSON } + + it { is_expected.to be_nil } + end + end + describe '#whats_new_most_recent_release_items' do let(:fixture_dir_glob) { Dir.glob(File.join('spec', 'fixtures', 'whats_new', '*.yml')) } |