Sha256: f36b84ba5f9d59ee1193dd6146d05f647418dbe42933dedabe6cb1d4c4e4b3c3

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require 'assert'
require 'ardb/adapter/mysql'

class Ardb::Adapter::Mysql

  class UnitTests < Assert::Context
    desc "Ardb::Adapter::Mysql"
    setup do
      @config  = Factory.ardb_config
      @adapter = Ardb::Adapter::Mysql.new(@config)
    end
    subject{ @adapter }

    should "know its foreign key add sql" do
      exp_add_sql = "ALTER TABLE :from_table"\
                    " ADD CONSTRAINT :name"\
                    " FOREIGN KEY (:from_column)"\
                    " REFERENCES :to_table (:to_column)"
      assert_equal exp_add_sql, subject.foreign_key_add_sql
    end

    should "know its foreign key drop sql" do
      exp_drop_sql = "ALTER TABLE :from_table"\
                     " DROP FOREIGN KEY :name"
      assert_equal exp_drop_sql, subject.foreign_key_drop_sql
    end

    # not currently implemented, see: https://github.com/redding/ardb/issues/13
    should "not implement the create and drop db methods" do
      assert_raises(NotImplementedError){ subject.create_db }
      assert_raises(NotImplementedError){ subject.drop_db }
    end

    # not currently implemented, see: https://github.com/redding/ardb/issues/28
    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.28.3 test/unit/adapter/mysql_tests.rb
ardb-0.28.2 test/unit/adapter/mysql_tests.rb
ardb-0.28.1 test/unit/adapter/mysql_tests.rb
ardb-0.28.0 test/unit/adapter/mysql_tests.rb