Fix growstuff markdown specs to expect path only links

This commit is contained in:
Brenda Wallace
2019-07-11 23:32:29 +12:00
committed by always-be-closing[bot]
parent 408e8388f2
commit addb9a48cf

View File

@@ -7,7 +7,7 @@ def input_link(name)
end
def output_link(crop, name = nil)
url = Rails.application.routes.url_helpers.crop_url(crop, host: Rails.application.config.host)
url = Rails.application.routes.url_helpers.crop_url(crop, only_path: true)
return "<a href=\"#{url}\">#{name}</a>" if name
"<a href=\"#{url}\">#{crop.name}</a>"
@@ -62,7 +62,7 @@ describe 'Haml::Filters::Growstuff_Markdown' do
end
it "finds crops case insensitively" do
@crop = FactoryBot.create(:crop, name: 'tomato')
@crop = FactoryBot.create(:crop, name: 'tomato', slug: 'tomato')
rendered = Haml::Filters::GrowstuffMarkdown.render(input_link('ToMaTo'))
expect(rendered).to match(/#{output_link(@crop, 'ToMaTo')}/)
end