Sha256: 7bc2ea642dbfae7a6b1595c07af1841d70d7ac3231305dba518ea24f9d20a37b
Contents?: true
Size: 1014 Bytes
Versions: 2
Compression:
Stored size: 1014 Bytes
Contents
require "cases/helper" require 'models/post' require 'models/comment' module ActiveRecord module ConnectionAdapters class MysqlSchemaTest < ActiveRecord::TestCase fixtures :posts def setup @connection = ActiveRecord::Base.connection db = Post.connection_pool.spec.config[:database] table = Post.table_name @db_name = db @omgpost = Class.new(ActiveRecord::Base) do self.table_name = "#{db}.#{table}" def self.name; 'Post'; end end end def test_schema assert @omgpost.find(:first) end def test_primary_key assert_equal 'id', @omgpost.primary_key end def test_table_exists? name = @omgpost.table_name assert @connection.table_exists?(name), "#{name} table should exist" end def test_table_exists_wrong_schema assert(!@connection.table_exists?("#{@db_name}.zomg"), "table should not exist") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activerecord-nuodb-adapter-2.0.3 | test/cases/adapters/mysql/schema_test.rb |
activerecord-nuodb-adapter-2.0 | test/cases/adapters/mysql/schema_test.rb |