From 2bce22fbb88056641e97307c18e38971cbb2474c Mon Sep 17 00:00:00 2001 From: "James R. Griffin III" Date: Thu, 21 Jun 2018 12:40:12 -0400 Subject: [PATCH] Implementing a test for the new helper --- spec/helpers/index_helper_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/helpers/index_helper_spec.rb b/spec/helpers/index_helper_spec.rb index 2d31f1de..f4110451 100644 --- a/spec/helpers/index_helper_spec.rb +++ b/spec/helpers/index_helper_spec.rb @@ -22,6 +22,8 @@ class TestingHelper end describe '#index_masonry_document_label' do + subject(:output) { helper.index_masonry_document_label(document) } + let(:label) { 'title' } before do @@ -30,6 +32,17 @@ class TestingHelper allow(index_presenter).to receive(:label).and_return(label) end + it 'retrieves the label using the title' do + expect(output).to eq 'title' + end + + context 'when multiple titles exist' do + let(:label) { ['title1', 'title2'] } + + it 'retrieves the label using only the first title' do + expect(output).to eq 'title1' + end + end end describe '#render_index_document' do