<commit_before>require 'spec_helper'

module Rake
  module TableTask

    describe Db do

      test_table = "test"

      it "finds a table when it exists" do
        if !Db.table_exists?(test_table)
          Db.execute <<-EOSQL
            create table #{test_table} (var1 text)
          EOSQL
        end
        expect(Db.table_exists?(test_table)).to be_true
      end

      it "does not find a table when it does not exist" do
        if Db.table_exists?(test_table)
          Db.execute <<-EOSQL
            drop table #{test_table}
          EOSQL
        end
        expect(Db.table_exists?(test_table)).to be_false
      end

      it "says it is tracking tables after tracking is set up" do
        Db.set_up_tracking
        expect(Db.tracking_tables?).to be_true
      end

      it "says it is not tracking tables after tracking is torn down" do
        Db.tear_down_tracking
        expect(Db.tracking_tables?).to be_false
      end

    end

  end
end
<commit_msg>Add tests for table creation, table drops<commit_after>require 'spec_helper'

module Rake
  module TableTask

    describe Db do

      test_table = "test"

      it "finds a table when it exists" do
        if !Db.table_exists?(test_table)
          Db.execute <<-EOSQL
            create table #{test_table} (var1 text)
          EOSQL
        end
        expect(Db.table_exists?(test_table)).to be_true
      end

      it "does not find a table when it does not exist" do
        if Db.table_exists?(test_table)
          Db.execute <<-EOSQL
            drop table #{test_table}
          EOSQL
        end
        expect(Db.table_exists?(test_table)).to be_false
      end

      it "creates a table when called to" do
        Db.create_table test_table, nil, '(var1 text)'
        expect(Db.table_exists?(test_table)).to be_true
      end

      it "drops a table when called to" do
        Db.create_table test_table, nil, '(var1 text)'
        Db.drop_table test_table
        expect(Db.table_exists?(test_table)).to be_false
      end

      it "says it is tracking tables after tracking is set up" do
        Db.tear_down_tracking
        Db.set_up_tracking
        expect(Db.tracking_tables?).to be_true
      end

      it "says it is not tracking tables after tracking is torn down" do
        Db.tear_down_tracking
        expect(Db.tracking_tables?).to be_false
      end

    end

  end
end

{'fraction_non_alphanumeric': 0.0707112970711297, 'fraction_numerical': 0.0016736401673640166, 'mean_word_length': 2.057544757033248, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2706336', 'n_tokens_mistral': 765, 'n_tokens_neox': 727, 'n_words': 227}