<commit_before>require 'database_cleaner'

RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.strategy = (ENV['JS'] == 'false' ? :transaction : :truncation)
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end<commit_msg>Wrap :js examples and set DatabaseCleaner strategy to :truncation before the spec and back to :transaction afterward.<commit_after>require 'database_cleaner'

RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end

  config.around(:each, :js) do |example|
    DatabaseCleaner.strategy = :truncation
    example.call
    DatabaseCleaner.strategy = :transaction
  end
end
{'fraction_non_alphanumeric': 0.09590643274853801, 'fraction_numerical': 0.0, 'mean_word_length': 4.251533742331288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2748517', 'n_tokens_mistral': 268, 'n_tokens_neox': 259, 'n_words': 66}