File tree Expand file tree Collapse file tree
lib/database_cleaner/active_record
database_cleaner/active_record Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
2828 spec . add_development_dependency "mysql2"
2929 spec . add_development_dependency "pg"
3030 spec . add_development_dependency "sqlite3"
31+ spec . add_development_dependency "trilogy"
3132end
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ def build_table_stats_query(connection)
6464 end
6565
6666 def information_schema_exists? connection
67- connection . adapter_name == "Mysql2"
67+ [ "Mysql2" , "Trilogy" ] . include? ( connection . adapter_name )
6868 end
6969 end
7070 end
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ class ConnectionWrapper < SimpleDelegator
6262 def initialize ( connection )
6363 extend AbstractAdapter
6464 case connection . adapter_name
65- when "Mysql2"
65+ when "Mysql2" , "Trilogy"
6666 extend AbstractMysqlAdapter
6767 when "SQLite"
6868 extend AbstractMysqlAdapter
Original file line number Diff line number Diff line change 9191 subject ( :strategy ) { described_class . new ( cache_tables : true ) }
9292
9393 it 'caches the list of tables to be deleted from' do
94- if helper . db == :mysql2
94+ if [ :mysql2 , :trilogy ] . include? ( helper . db )
9595 expect ( strategy ) . to receive ( :build_table_stats_query ) . once . and_return ( "" )
9696 elsif helper . db == :postgres
9797 expect ( strategy . send ( :connection ) ) . to receive ( :tables_with_schema ) . once . and_return ( [ ] )
108108 subject ( :strategy ) { described_class . new ( cache_tables : false ) }
109109
110110 it 'does not cache the list of tables to be deleted from' do
111- if helper . db == :mysql2
111+ if [ :mysql2 , :trilogy ] . include? ( helper . db )
112112 expect ( strategy ) . to receive ( :build_table_stats_query ) . twice . and_return ( "" )
113113 elsif helper . db == :postgres
114114 expect ( strategy . send ( :connection ) ) . to receive ( :tables_with_schema ) . twice . and_return ( [ ] )
Original file line number Diff line number Diff line change 33
44class DatabaseHelper < DatabaseCleaner ::Spec ::DatabaseHelper
55 def self . with_all_dbs &block
6- %w[ mysql2 sqlite3 postgres ] . map ( &:to_sym ) . each do |db |
6+ %w[ mysql2 sqlite3 postgres trilogy ] . map ( &:to_sym ) . each do |db |
77 yield new ( db )
88 end
99 end
You can’t perform that action at this time.
0 commit comments