<commit_before>require 'spec_helper'

describe Memdash do
  before do
    Memdash.ttl = 2
  end

  def reports_count
    Memdash::ActiveRecord::Report.count
  end

  it "records gets" do
    expect{ dalli.get("key") }.to change{ reports_count }.by(1)
  end

  it "waits between recording gets" do
    dalli.get("key")
    sleep 1
    expect{ dalli.get("key") }.to_not change{ reports_count }
    sleep 2
    expect{ dalli.get("key") }.to change{ reports_count }.by(1)
  end

  it "records sets" do
    expect{ dalli.set("key", "value") }.to change{ reports_count }.by(1)
  end

  it "waits between recording sets" do
    dalli.set("key", "value")
    sleep 1
    expect{ dalli.set("key", "value") }.to_not change{ reports_count }
    sleep 2
    expect{ dalli.set("key", "value") }.to change{ reports_count }.by(1)
  end
end<commit_msg>Single quotes<commit_after>require 'spec_helper'

describe Memdash do
  before do
    Memdash.ttl = 2
  end

  def reports_count
    Memdash::ActiveRecord::Report.count
  end

  it 'records gets' do
    expect{ dalli.get('key') }.to change{ reports_count }.by(1)
  end

  it 'waits between recording gets' do
    dalli.get('key')
    sleep 1
    expect{ dalli.get('key') }.to_not change{ reports_count }
    sleep 2
    expect{ dalli.get('key') }.to change{ reports_count }.by(1)
  end

  it 'records sets' do
    expect{ dalli.set('key', 'value') }.to change{ reports_count }.by(1)
  end

  it 'waits between recording sets' do
    dalli.set('key', 'value')
    sleep 1
    expect{ dalli.set('key', 'value') }.to_not change{ reports_count }
    sleep 2
    expect{ dalli.set('key', 'value') }.to change{ reports_count }.by(1)
  end
end
{'fraction_non_alphanumeric': 0.13636363636363635, 'fraction_numerical': 0.01076555023923445, 'mean_word_length': 3.267857142857143, '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': '194506', 'n_tokens_mistral': 620, 'n_tokens_neox': 597, 'n_words': 174}