Sha256: 2025018780f6e5e46b2949ab9c8baff74706fc2c2956f531ebc51632c961662c

Contents?: true

Size: 937 Bytes

Versions: 7

Compression:

Stored size: 937 Bytes

Contents

#! /usr/bin/env jruby

require 'jdbc_common'
require 'db/mssql'

class IgnoreSystemViewsTest < Test::Unit::TestCase

  include MigrationSetup

  def test_system_views_ignored
    assert_equal true, table_exists?("sys.views"), %{table_exists?("sys.views")}
    assert_equal true, table_exists?("information_schema.views"), %{table_exists?("information_schema.views")}
    assert_equal false, table_exists?("dbo.views"), %{table_exists?("dbo.views")}
    assert_equal false, table_exists?(:views), %{table_exists?(:views)}
    ActiveRecord::Schema.define { suppress_messages { create_table :views } }
    assert_equal true, table_exists?(:views), %{table_exists?(:views)}
    ActiveRecord::Schema.define { suppress_messages { drop_table :views } }
    assert_equal false, table_exists?(:views), %{table_exists?(:views)}
  end

  private

    def table_exists?(*args)
      !!ActiveRecord::Base.connection.table_exists?(*args)
    end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
tgbyte-activerecord-jdbc-adapter-1.2.2.5 test/mssql_ignore_system_views_test.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.4 test/mssql_ignore_system_views_test.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.3 test/mssql_ignore_system_views_test.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.2 test/mssql_ignore_system_views_test.rb
activerecord-jdbc-adapter-1.2.2.1 test/mssql_ignore_system_views_test.rb
activerecord-jdbc-adapter-onsite-1.2.2 test/mssql_ignore_system_views_test.rb
activerecord-jdbc-adapter-1.2.2 test/mssql_ignore_system_views_test.rb