Sha256: 8e381359f39dac1d54cc2751e70a72406079fb40b9bdd6a40dd515cc3e68614c

Contents?: true

Size: 693 Bytes

Versions: 2

Compression:

Stored size: 693 Bytes

Contents

require 'abstract_db_create'
require 'db/mssql'

class MysqlDbCreateTest < Test::Unit::TestCase
  include AbstractDbCreate

  def db_config
    MSSQL_CONFIG
  end

  def test_rake_db_create
    begin
      Rake::Task["db:create"].invoke
    rescue => e
      if e.message =~ /CREATE DATABASE permission denied/
        puts "\nwarning: db:create test skipped; add 'dbcreator' role to user '#{db_config[:username]}' to run"
        return
      end
    end
    ActiveRecord::Base.establish_connection(db_config.merge(:database => "master"))
    databases = ActiveRecord::Base.connection.select_rows("SELECT NAME FROM sys.sysdatabases").flatten
    assert databases.include?(@db_name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-0.9.6-java test/mssql_db_create_test.rb
activerecord-jdbc-adapter-0.9.5-java test/mssql_db_create_test.rb