debian-mirror-gitlab/spec/support/helpers/assets_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
555 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
module AssetsHelpers
# In a CI environment the assets are not compiled, as there is a CI job
# `compile-assets` that compiles them in the prepare stage for all following
# specs.
# Locally the assets are precompiled dynamically.
#
# Sprockets doesn't provide one method to access an asset for both cases.
def find_asset(asset_name)
if ENV['CI']
Sprockets::Railtie.build_environment(Rails.application, true)[asset_name]
else
Rails.application.assets.find_asset(asset_name)
end
end
end