Sha256: 5a133db06ca181328dc83fb735f5b24f7f2e851c1b1b6bb44cc0234add223a03

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'assert'
require 'ardb/adapter/sqlite'

class Ardb::Adapter::Sqlite

  class UnitTests < Assert::Context
    desc "Ardb::Adapter::Sqlite"
    setup do
      @adapter = Ardb::Adapter::Sqlite.new
    end
    subject{ @adapter }

    should have_imeths :db_file_path, :validate!

    should "complain if the db file already exists" do
      FileUtils.mkdir_p(File.dirname(subject.db_file_path))
      FileUtils.touch(subject.db_file_path)
      assert_raises(RuntimeError){ subject.validate! }
      FileUtils.rm(subject.db_file_path)
    end

    should "know its db file path" do
      exp_path = Ardb.config.root_path.join(Ardb.config.db.database).to_s
      assert_equal exp_path, subject.db_file_path
    end

    should "not implement the foreign key sql meths" do
      assert_raises(NotImplementedError){ subject.foreign_key_add_sql }
      assert_raises(NotImplementedError){ subject.foreign_key_drop_sql }
    end

    # not currently implemented, see: https://github.com/redding/ardb/issues/29
    should "not implement the drop tables method" do
      assert_raises(NotImplementedError){ subject.drop_tables }
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ardb-0.27.3 test/unit/adapter/sqlite_tests.rb
ardb-0.27.2 test/unit/adapter/sqlite_tests.rb
ardb-0.27.1 test/unit/adapter/sqlite_tests.rb
ardb-0.27.0 test/unit/adapter/sqlite_tests.rb