2020-08-26 02:10:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe WhatsNewHelper do
|
2021-04-12 17:11:12 -04:00
|
|
|
describe '#whats_new_version_digest' do
|
|
|
|
let(:digest) { 'digest' }
|
2020-09-28 14:09:40 -04:00
|
|
|
|
2021-04-12 17:11:12 -04:00
|
|
|
it 'calls ReleaseHighlight.most_recent_version_digest' do
|
|
|
|
expect(ReleaseHighlight).to receive(:most_recent_version_digest).and_return(digest)
|
2020-11-24 13:09:14 -05:00
|
|
|
|
2021-04-12 17:11:12 -04:00
|
|
|
expect(helper.whats_new_version_digest).to eq(digest)
|
2020-09-28 14:09:40 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#whats_new_most_recent_release_items_count' do
|
|
|
|
subject { helper.whats_new_most_recent_release_items_count }
|
|
|
|
|
|
|
|
context 'when recent release items exist' do
|
2020-10-14 14:08:47 -04:00
|
|
|
it 'returns the count from the most recent file' do
|
2020-11-24 13:09:14 -05:00
|
|
|
allow(ReleaseHighlight).to receive(:most_recent_item_count).and_return(1)
|
2020-09-28 14:09:40 -04:00
|
|
|
|
2020-10-14 14:08:47 -04:00
|
|
|
expect(subject).to eq(1)
|
|
|
|
end
|
2020-09-28 14:09:40 -04:00
|
|
|
end
|
2020-08-26 02:10:34 -04:00
|
|
|
|
2020-10-14 14:08:47 -04:00
|
|
|
context 'when recent release items do NOT exist' do
|
2020-11-24 13:09:14 -05:00
|
|
|
it 'returns nil' do
|
|
|
|
allow(ReleaseHighlight).to receive(:most_recent_item_count).and_return(nil)
|
2020-08-26 02:10:34 -04:00
|
|
|
|
2020-10-14 14:08:47 -04:00
|
|
|
expect(subject).to be_nil
|
|
|
|
end
|
2020-08-26 02:10:34 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|