mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-01 06:41:41 +00:00
Add save_and_open spec helper method to open HTML emails in the browser
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
10
spec/support/html_helper.rb
Normal file
10
spec/support/html_helper.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user