Sha256: 2e7c8998dfd5f48feb7ab68c8b8ee96bc20c2a3af0a95fa293f6618915a13e1a

Contents?: true

Size: 1.13 KB

Versions: 21

Compression:

Stored size: 1.13 KB

Contents

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

class Ardb::Adapter::Sqlite

  class BaseTests < 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(Ardb::Runner::CmdError) { 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

21 entries across 21 versions & 1 rubygems

Version Path
ardb-0.20.0 test/unit/adapter/sqlite_tests.rb
ardb-0.19.0 test/unit/adapter/sqlite_tests.rb
ardb-0.18.0 test/unit/adapter/sqlite_tests.rb
ardb-0.17.0 test/unit/adapter/sqlite_tests.rb
ardb-0.16.0 test/unit/adapter/sqlite_tests.rb
ardb-0.15.0 test/unit/adapter/sqlite_tests.rb
ardb-0.14.0 test/unit/adapter/sqlite_tests.rb
ardb-0.13.0 test/unit/adapter/sqlite_tests.rb
ardb-0.12.0 test/unit/adapter/sqlite_tests.rb
ardb-0.11.0 test/unit/adapter/sqlite_tests.rb
ardb-0.10.0 test/unit/adapter/sqlite_tests.rb
ardb-0.9.0 test/unit/adapter/sqlite_tests.rb
ardb-0.8.0 test/unit/adapter/sqlite_tests.rb
ardb-0.7.0 test/unit/adapter/sqlite_tests.rb
ardb-0.6.0 test/unit/adapter/sqlite_tests.rb
ardb-0.5.0 test/unit/adapter/sqlite_tests.rb
ardb-0.4.1 test/unit/adapter/sqlite_tests.rb
ardb-0.4.0 test/unit/adapter/sqlite_tests.rb
ardb-0.3.0 test/unit/adapter/sqlite_tests.rb
ardb-0.2.0 test/unit/adapter/sqlite_tests.rb