<commit_before>require "spec_helper"

describe Mobility::InstallGenerator, type: :generator, orm: :active_record do
  require "generator_spec/test_case"
  include GeneratorSpec::TestCase
  include Helpers::Generators

  destination File.expand_path("../tmp", __FILE__)

  after(:all) { prepare_destination }

  describe "no options" do
    before(:all) do
      prepare_destination
      run_generator
    end

    it "generates initializer" do
      expect(destination_root).to have_structure {
        directory "config" do
          directory "initializers" do
            file "mobility.rb" do
              contains "Mobility.configure do |config|"
              contains "config.default_backend = :key_value"
              contains "config.accessor_method = :translates"
              contains "config.query_method    = :i18n"
            end
          end
        end
      }
    end

    it "generates migration for text translations table" do
      version_string_ = version_string

      expect(destination_root).to have_structure {
        directory "db" do
          directory "migrate" do
            migration "create_text_translations" do
              if ENV["RAILS_VERSION"] < "5.0"<commit_msg>Fix install generator spec<commit_after>require "spec_helper"

describe Mobility::InstallGenerator, type: :generator, orm: :active_record do
  require "generator_spec/test_case"
  include GeneratorSpec::TestCase
  include Helpers::Generators

  destination File.expand_path("../tmp", __FILE__)

  after(:all) { prepare_destination }

  describe "no options" do
    before(:all) do
      prepare_destination
      run_generator
    end

    it "generates initializer" do
      expect(destination_root).to have_structure {
        directory "config" do
          directory "initializers" do
            file "mobility.rb" do
              contains "Mobility.configure do |config|"
              contains "plugin :backend, default: :key_value"
              contains "plugin :query"
              contains "config.accessor_method = :translates"
            end
          end
        end
      }
    end

    it "generates migration for text translations table" do
      version_string_ = version_string

      expect(destination_root).to have_structure {
        directory "db" do
          directory "migrate" do
            migration "create_text_translations" do
              if ENV["RAILS_VERSION"] < "5.0"
{'fraction_non_alphanumeric': 0.07730467135179826, 'fraction_numerical': 0.0024803637866887144, 'mean_word_length': 2.5123367198838897, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4438131', 'n_tokens_mistral': 659, 'n_tokens_neox': 643, 'n_words': 174}