Sha256: b312f09ce6e87ff8f1fb58b32506228e04969b87b5a3f838fbe6d04bf48aba62
Contents?: true
Size: 1.84 KB
Versions: 22
Compression:
Stored size: 1.84 KB
Contents
# frozen_string_literal: true describe SirTrevorRails::Blocks::SolrDocumentsBlock do subject { described_class.new({ type: '', data: block_data }, page) } let(:page) { FactoryBot.create(:feature_page) } let(:block_data) { {} } describe '#text' do it "is the block's text data" do block_data[:text] = 'abc' expect(subject.text).to eq 'abc' end it "squelches sir-trevor's placeholder values" do block_data[:text] = '<p><br></p>' expect(subject.text).to be_blank end end describe '#primary_caption?' do it 'is false if the primary caption field is not configured' do block_data['show-primary-caption'] = 'true' expect(subject.primary_caption?).to eq false end it 'is false if the field is configured not to show' do block_data['primary-caption-field'] = 'some_field' block_data['show-primary-caption'] = 'false' expect(subject.primary_caption?).to eq false end it 'is true if the field is configured to show' do block_data['primary-caption-field'] = 'some_field' block_data['show-primary-caption'] = 'true' expect(subject.primary_caption?).to eq true end end describe '#secondary_caption?' do it 'is false if the secondary caption field is not configured' do block_data['show-secondary-caption'] = 'true' expect(subject.secondary_caption?).to eq false end it 'is false if the field is configured not to show' do block_data['secondary-caption-field'] = 'some_field' block_data['show-secondary-caption'] = 'false' expect(subject.secondary_caption?).to eq false end it 'is true if the field is configured to show' do block_data['secondary-caption-field'] = 'some_field' block_data['show-secondary-caption'] = 'true' expect(subject.secondary_caption?).to eq true end end end
Version data entries
22 entries across 22 versions & 1 rubygems