searched_address=[log.address_line1_input,log.postcode_full_input].select(&:present?).map{|x|"<strong>#{x}</strong>"}.join(" and ")
"#{address_options_count}#{'address'.pluralize(address_options_count)} found for #{searched_address}. <a href=\"#{page.skip_href(log)}\">Search again</a>".html_safe
searched_address=[log.address_line1_input,log.postcode_full_input].select(&:present?).map{|x|"<strong>#{x}</strong>"}.join(" and ")
"#{address_options_count}#{'address'.pluralize(address_options_count)} found for #{searched_address}. <a href=\"#{page.skip_href(log)}\">Search again</a>".html_safe
context"when the log has address line 1 input only"do
beforedo
log.address_line1_input="Address line 1"
log.postcode_full_input=nil
log.save!(valudate:false)
end
it"has the correct input_playback"do
expect(question.input_playback(log)).toeq("0 addresses found for <strong>Address line 1</strong>. <a href=\"skip_href\">Search again</a>")
end
end
context"when the log has postcode input only"do
beforedo
log.address_line1_input=nil
log.postcode_full_input="A1 1AA"
log.save!(valudate:false)
end
it"has the correct input_playback"do
expect(question.input_playback(log)).toeq("0 addresses found for <strong>A1 1AA</strong>. <a href=\"skip_href\">Search again</a>")
end
end
context"when the log has address line 1 and postcode inputs"do
beforedo
log.address_line1_input="Address line 1"
log.postcode_full_input="A1 1AA"
log.save!(valudate:false)
end
it"has the correct input_playback"do
expect(question.input_playback(log)).toeq("1 address found for <strong>Address line 1</strong> and <strong>A1 1AA</strong>. <a href=\"skip_href\">Search again</a>")
context"when the log has address line 1 input only"do
beforedo
log.address_line1_input="Address line 1"
log.postcode_full_input=nil
log.save!(valudate:false)
end
it"has the correct input_playback"do
expect(question.input_playback(log)).toeq("0 addresses found for <strong>Address line 1</strong>. <a href=\"skip_href\">Search again</a>")
end
end
context"when the log has postcode input only"do
beforedo
log.address_line1_input=nil
log.postcode_full_input="A1 1AA"
log.save!(valudate:false)
end
it"has the correct input_playback"do
expect(question.input_playback(log)).toeq("0 addresses found for <strong>A1 1AA</strong>. <a href=\"skip_href\">Search again</a>")
end
end
context"when the log has address line 1 and postcode inputs"do
beforedo
log.address_line1_input="Address line 1"
log.postcode_full_input="A1 1AA"
log.save!(valudate:false)
end
it"has the correct input_playback"do
expect(question.input_playback(log)).toeq("1 address found for <strong>Address line 1</strong> and <strong>A1 1AA</strong>. <a href=\"skip_href\">Search again</a>")