Sha256: 748ffd8244d6fbd570c5035bb333a87585d8b0a468210735b61e38bec9e9492b

Contents?: true

Size: 956 Bytes

Versions: 2

Compression:

Stored size: 956 Bytes

Contents

require 'test_helper'

class PostgresUnitTest < Test::Unit::TestCase

  test 'create_database (with options)' do
    connection = connection_stub
    connection.expects(:execute).with '' + 
      "CREATE DATABASE \"mega_development\" ENCODING = 'utf8' TABLESPACE = \"TS1\" OWNER = \"kimcom\""
    connection.create_database 'mega_development', 
      :tablespace => :'TS1', 'owner' => 'kimcom', :invalid => 'ignored'
  end
  
  test 'create_database (no options)' do
    connection = connection_stub
    connection.expects(:execute).with "CREATE DATABASE \"mega_development\" ENCODING = 'utf8'"
    connection.create_database 'mega_development'
  end
  
  private
  
  def connection_stub
    connection = mock('connection')
    (class << connection; self; end).class_eval do
      def self.alias_chained_method(*args); args; end
    end
    def connection.configure_connection; nil; end
    connection.extend ArJdbc::PostgreSQL
    connection
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.3.0.beta2 test/db/postgres/unit_test.rb
activerecord-jdbc-adapter-1.3.0.beta1 test/db/postgres/unit_test.rb