Sha256: 3c3c4893cecd2fbb6b7f5d61cf660f7ecec11f0bc3a264bd1ccbc32960b5368d

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

# encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
require 'active_record'
require 'active_record/connection_adapters/mysql2_adapter'

describe ActiveRecord::ConnectionAdapters::Mysql2Adapter do
  it "should be able to connect" do
    lambda {
      ActiveRecord::Base.establish_connection(:adapter => 'mysql2')
    }.should_not raise_error(Mysql2::Error)
  end
  
  context "once connected" do
    before(:each) do
      @connection = ActiveRecord::Base.connection
    end

    it "should be able to execute a raw query" do
      @connection.execute("SELECT 1 as one").first['one'].should eql(1)
      @connection.execute("SELECT NOW() as n").first['n'].class.should eql(Time)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mysql2-0.1.4 spec/active_record/active_record_spec.rb
mysql2-0.1.3 spec/active_record/active_record_spec.rb