Fixes case-sensitive SQLite3 adapter name typos.

The SQLite3 adapter name was referenced as
`ActiveRecord::ConnectionAdapters::Sqlite3Adapter`, but the
ActiveRecord class is spelled `SQLite3Adapter` (upper-case "SQL"). As
a result, `active_record/adapters/sqlite3_adapter.rb` wasn't actually
including the methods from `adapters/sqlite3_adapter.rb` into the AR
adapter class.

This adds a test for proper inheritance and fixes the spelling of
`SQLite3Adapter`, unifying all references to the ActiveRecord version.
This commit is contained in:
mildmojo 2012-10-01 02:42:33 -04:00
parent c08d31b528
commit 43bd628e05
3 changed files with 13 additions and 3 deletions

View file

@ -1,7 +1,7 @@
require "active_record/connection_adapters/sqlite3_adapter" require "active_record/connection_adapters/sqlite3_adapter"
require "activerecord-import/adapters/sqlite3_adapter" require "activerecord-import/adapters/sqlite3_adapter"
class ActiveRecord::ConnectionAdapters::Sqlite3Adapter class ActiveRecord::ConnectionAdapters::SQLite3Adapter
include ActiveRecord::Import::Sqlite3Adapter include ActiveRecord::Import::SQLite3Adapter
end end

View file

@ -1,4 +1,4 @@
module ActiveRecord::Import::Sqlite3Adapter module ActiveRecord::Import::SQLite3Adapter
def next_value_for_sequence(sequence_name) def next_value_for_sequence(sequence_name)
%{nextval('#{sequence_name}')} %{nextval('#{sequence_name}')}
end end

View file

@ -50,3 +50,13 @@ describe "ActiveRecord::ConnectionAdapter::AbstractAdapter" do
end end
end end
describe "ActiveRecord::Import DB-specific adapter class" do
context "when ActiveRecord::Import is in use" do
it "should appear in the AR connection adapter class's ancestors" do
connection = ActiveRecord::Base.connection
import_class_name = 'ActiveRecord::Import::' + connection.class.name.demodulize
assert_include connection.class.ancestors, import_class_name.constantize
end
end
end