Files
openfoodnetwork/spec/support/precompile_assets.rb
2023-11-23 17:23:47 +11:00

19 lines
604 B
Ruby

# frozen_string_literal: true
RSpec.configure do |config|
config.before(:suite) do
# We can use webpack-dev-server for tests, too!
# Useful if you working on a frontend code fixes and want to verify them via system tests.
next if Webpacker.dev_server.running?
specs_needing_assets = %i[controller feature mailer request system view]
examples = RSpec.world.filtered_examples.values.flatten
types = examples.map(&:metadata).pluck(:type).uniq
if types.intersect?(specs_needing_assets)
$stdout.puts "\n Precompiling assets.\n"
Webpacker.compile
end
end
end