<commit_before>require_relative '../test_helper'
require 'mocha/setup'
require 'rails/all'

setup_database

describe Sync::Model do

  it 'is disabled by default' do
    refute Sync::Model.enabled?
  end

  it 'can be enabled and disabled' do
    Sync::Model.enable!
    assert Sync::Model.enabled?

    Sync::Model.disable!
    refute Sync::Model.enabled?
  end

  it 'can be given a block to have things enabled in' do
    Sync::Model.enable do
      assert Sync::Model.enabled?
    end

    refute Sync::Model.enabled?
  end

  class FakeModel < ActiveRecord::Base
    self.table_name = 'todos'

    sync :all
  end

  let(:model) { FakeModel.new name: "Foo" }

  it 'can be mixed in to a model to allow sync' do
    model.stubs(:sync_new)
    model.stubs(:sync_update)
    model.stubs(:sync_destroy)

    Sync::Model.enable do<commit_msg>Fix Typo<commit_after>require_relative '../test_helper'
require 'mocha/setup'
require 'rails/all'

setup_database

describe Sync::Model do

  it 'is disabled by default' do
    refute Sync::Model.enabled?
  end

  it 'can be enabled and disabled' do
    Sync::Model.enable!
    assert Sync::Model.enabled?

    Sync::Model.disable!
    refute Sync::Model.enabled?
  end

  it 'can be given a block to have things enabled in' do
    Sync::Model.enable do
      assert Sync::Model.enabled?
    end

    refute Sync::Model.enabled?
  end

  class FakeModel < ActiveRecord::Base
    self.table_name = 'todos'

    sync :all
  end

  let(:model) { FakeModel.new name: "Foo" }

  it 'can be mixed into a model to allow sync' do
    model.stubs(:sync_new)
    model.stubs(:sync_update)
    model.stubs(:sync_destroy)

    Sync::Model.enable do
{'fraction_non_alphanumeric': 0.10369487485101311, 'fraction_numerical': 0.0, 'mean_word_length': 3.229219143576826, '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': '5595542', 'n_tokens_mistral': 592, 'n_tokens_neox': 555, 'n_words': 163}