summaryrefslogtreecommitdiff
path: root/spec/helpers/whats_new_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-26 06:10:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-26 06:10:34 +0000
commitfb553bbc1899eddaddb07cd9685cdabffbed9962 (patch)
tree473f1ad59a01e98d6ee1a04f462e524bb585f1e4 /spec/helpers/whats_new_helper_spec.rb
parenta51e52bf5b7a708255a858ca51de8d4a6e58b074 (diff)
downloadgitlab-ce-fb553bbc1899eddaddb07cd9685cdabffbed9962.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/whats_new_helper_spec.rb')
-rw-r--r--spec/helpers/whats_new_helper_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/helpers/whats_new_helper_spec.rb b/spec/helpers/whats_new_helper_spec.rb
new file mode 100644
index 00000000000..db880163454
--- /dev/null
+++ b/spec/helpers/whats_new_helper_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe WhatsNewHelper do
+ describe '#whats_new_most_recent_release_items' do
+ let(:fixture_dir_glob) { Dir.glob(File.join('spec', 'fixtures', 'whats_new', '*.yml')) }
+
+ it 'returns json from the most recent file' do
+ allow(Dir).to receive(:glob).with(Rails.root.join('data', 'whats_new', '*.yml')).and_return(fixture_dir_glob)
+
+ expect(helper.whats_new_most_recent_release_items).to include({ title: "bright and sunshinin' day" }.to_json)
+ end
+
+ it 'fails gracefully and logs an error' do
+ allow(YAML).to receive(:load_file).and_raise
+
+ expect(Gitlab::ErrorTracking).to receive(:track_exception)
+ expect(helper.whats_new_most_recent_release_items).to eq(''.to_json)
+ end
+ end
+end