<commit_before>require 'acceptance/spec_helper'

describe "Basics" do
  describe "for an initialized database" do
    subject {
      Ashikawa::Core::Database.new do |config|
        config.url = ARANGO_HOST
      end
    }

    after :each do
      subject.collections.each { |collection| collection.delete }
    end

    it "should do what the README describes" do
      subject["my_collection"]
      subject["my_collection"].name = "new_name"
      subject["new_name"].delete
    end

    it "should create and delete collections" do
      subject.collections.each { |collection| collection.delete }
      subject["collection_1"]
      subject["collection_2"]
      subject["collection_3"]
      subject.collections.length.should == 3
      subject["collection_3"].delete
      subject.collections.length.should == 2
    end

    it "should create a non-volatile collection by default" do
      subject.create_collection("nonvolatile_collection")
      subject["nonvolatile_collection"].volatile?.should be_false
    end

    it "should create a volatile collection" do
      subject.create_collection("volatile_collection", :is_volatile => true)
      subject["volatile_collection"].volatile?.should be_true
    end

    it "should create an autoincrementing collection" do
      subject.create_collection("autoincrement_collection", :is_volatile => true, :key_options => {
        :type => :autoincrement,
        :increment => 10,
        :allow_user_keys => false
      })
      key_options = subject["autoincrement_collection"].key_options

      key_options.type.should == "autoincrement"
      key_options.offset.should == 0
      key_options.increment.should == 10
      key_options.allow_user_keys.should == false
    end

    it "should be possible to create an edge collection" do
      subject.create_collection("edge_collection", :content_type => :edge)
      subject["edge_collection"].content_type.should == :edge
    end

    it "should be possible to change the name of a collection" do
      my_collection = subject["test_collection"]
      my_collection.name.should == "test_collection"
      my_collection.name = "my_new_name"
      my_collection.name.should == "my_new_name"
    end

    it "should be possible to find a collection by ID" do
      my_collection = subject["test_collection"]
      subject[my_collection.id].name.should == "test_collection"
    end

    it "should be possible to list all system and all non-system collections" do
      subject.collections.length.should == 0<commit_msg>Acceptance Test<commit_after>require 'acceptance/spec_helper'

describe "Basics" do
  describe "for an initialized database" do
    subject {
      Ashikawa::Core::Database.new do |config|
        config.url = ARANGO_HOST
      end
    }

    after :each do
      subject.collections.each { |collection| collection.delete }
    end

    it "should do what the README describes" do
      subject["my_collection"]
      subject["my_collection"].name = "new_name"
      subject["new_name"].delete
    end

    it "should create and delete collections" do
      subject.collections.each { |collection| collection.delete }
      subject["collection_1"]
      subject["collection_2"]
      subject["collection_3"]
      subject.collections.length.should == 3
      subject["collection_3"].delete
      subject.collections.length.should == 2
    end

    it "should create a non-volatile collection by default" do
      subject.create_collection("nonvolatile_collection")
      subject["nonvolatile_collection"].volatile?.should be_false
    end

    it "should create a volatile collection" do
      subject.create_collection("volatile_collection", :is_volatile => true)
      subject["volatile_collection"].volatile?.should be_true
    end

    it "should create an autoincrementing collection" do
      subject.create_collection("autoincrement_collection", :is_volatile => true, :key_options => {
        :type => :autoincrement,
        :increment => 10,
        :allow_user_keys => false
      })
      key_options = subject["autoincrement_collection"].key_options

      key_options.type.should == "autoincrement"
      key_options.offset.should == 0
      key_options.increment.should == 10
      key_options.allow_user_keys.should == false
    end

    it "should be possible to create an edge collection" do
      subject.create_collection("edge_collection", :content_type => :edge)
      subject["edge_collection"].content_type.should == :edge
    end

    it "should be possible to change the name of a collection" do
      my_collection = subject["test_collection"]
      my_collection.name.should == "test_collection"
      my_collection.name = "my_new_name"
      my_collection.name.should == "my_new_name"
    end

    it "should be possible to find a collection by ID" do
      my_collection = subject["test_collection"]
      subject[my_collection.id].name.should == "test_collection"
    end

    it "should be possible to list all system collections" do
{'fraction_non_alphanumeric': 0.09415064102564102, 'fraction_numerical': 0.004607371794871795, 'mean_word_length': 3.2969018932874357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '6513959', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1343, 'n_words': 353}