Skip to content
Browse files

Fix issues with mysql2 adaptor support

  • Loading branch information...
1 parent 38e5ce9 commit 2412614605c165fb31cf8b06024ec707c17c962f @BDQ BDQ committed
View
14 lib/apartment/adapters/mysql_adapter.rb → lib/apartment/adapters/mysql2_adapter.rb
@@ -1,16 +1,16 @@
module Apartment
module Database
-
+
def self.mysql2_adapter(config)
- Adapters::MysqlAdapter.new config
+ Adapters::Mysql2Adapter.new config
end
end
-
+
module Adapters
-
- class MysqlAdapter < AbstractAdapter
-
+
+ class Mysql2Adapter < AbstractAdapter
+
protected
# Connect to new database
@@ -26,4 +26,4 @@ def connect_to_new(database)
end
end
end
-end
+end
View
14 spec/adapters/mysql_adapter_spec.rb → spec/adapters/mysql2_adapter_spec.rb
@@ -1,17 +1,17 @@
require 'spec_helper'
-require 'apartment/adapters/mysql_adapter'
+require 'apartment/adapters/mysql2_adapter'
+
+describe Apartment::Adapters::Mysql2Adapter do
-describe Apartment::Adapters::MysqlAdapter do
-
let(:config){ Apartment::Test.config['connections']['mysql'] }
subject{ Apartment::Database.mysql2_adapter config.symbolize_keys }
-
+
def database_names
ActiveRecord::Base.connection.execute("SELECT schema_name FROM information_schema.schemata").collect{|row| row[0]}
end
-
+
let(:default_database){ subject.process{ ActiveRecord::Base.connection.current_database } }
-
+
it_should_behave_like "a generic apartment adapter"
it_should_behave_like "a db based apartment adapter"
-end
+end
View
2 spec/database_spec.rb
@@ -19,7 +19,7 @@
it "should load mysql adapter" do
subject.adapter
- Apartment::Adapters::MysqlAdapter.should be_a(Class)
+ Apartment::Adapters::Mysql2Adapter.should be_a(Class)
end
end

0 comments on commit 2412614

Please sign in to comment.
Something went wrong with that request. Please try again.