diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d5410a5026..2bf1063dca 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -92,6 +92,7 @@ RSpec.configure do |config| config.include OpenFoodNetwork::FeatureToggleHelper config.include OpenFoodNetwork::EnterpriseGroupsHelper config.include OpenFoodNetwork::DistributionHelper + config.include OpenFoodNetwork::HtmlHelper config.include ActionView::Helpers::DateHelper config.include OpenFoodNetwork::DelayedJobHelper diff --git a/spec/support/html_helper.rb b/spec/support/html_helper.rb new file mode 100644 index 0000000000..54c6ffe1f1 --- /dev/null +++ b/spec/support/html_helper.rb @@ -0,0 +1,10 @@ +module OpenFoodNetwork + module HtmlHelper + def save_and_open(html) + require "launchy" + file = Tempfile.new('html') + file.write html + Launchy.open(file.path) + end + end +end