diff options
Diffstat (limited to 'spec/support/frontend_fixtures.rb')
-rw-r--r-- | spec/support/frontend_fixtures.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/frontend_fixtures.rb b/spec/support/frontend_fixtures.rb new file mode 100644 index 00000000000..5587d9059dd --- /dev/null +++ b/spec/support/frontend_fixtures.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +return unless ENV['CI'] +return unless ENV['GENERATE_FRONTEND_FIXTURES_MAPPING'] == 'true' + +RSpec.configure do |config| + config.before(:suite) do + $fixtures_mapping = Hash.new { |h, k| h[k] = [] } # rubocop:disable Style/GlobalVars + end + + config.after(:suite) do + next unless ENV['FRONTEND_FIXTURES_MAPPING_PATH'] + + File.write(ENV['FRONTEND_FIXTURES_MAPPING_PATH'], $fixtures_mapping.to_json) # rubocop:disable Style/GlobalVars + end +end |