Sha256: 3c1c6ca6469a35c595c8b6715325a1bea0ea3b0a1a5ceeca9acab3bf464d9ece

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

require 'cases/helper'

class PostgresqlActiveSchemaTest < ActiveRecord::TestCase
  def setup
    ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
      alias_method :real_execute, :execute
      remove_method :execute
      def execute(sql, name = nil) sql end
    end
  end

  def teardown
    ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
      remove_method :execute
      alias_method :execute, :real_execute
    end
  end

  def test_create_database_with_encoding
    assert_equal %(CREATE DATABASE "matt" ENCODING = 'utf8'), create_database(:matt)
    assert_equal %(CREATE DATABASE "aimonetti" ENCODING = 'latin1'), create_database(:aimonetti, :encoding => :latin1)
  end

  private
    def method_missing(method_symbol, *arguments)
      ActiveRecord::Base.connection.send(method_symbol, *arguments)
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-nuodb-adapter-2.0.3 test/cases/adapters/postgresql/active_schema_test.rb
activerecord-nuodb-adapter-2.0 test/cases/adapters/postgresql/active_schema_test.rb