File tree Expand file tree Collapse file tree
database_cleaner/active_record Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,23 @@ module ActiveRecord
3838 expect ( strategy . connection_hash ) . to eq ( { 'database' => 'one' } )
3939 end
4040
41+ context 'when the configs are aliased' do
42+ let ( :other_db ) { :other_db }
43+ let ( :config_location ) { 'spec/support/aliased-example.database.yml' }
44+
45+ it 'loads configs correctly' do
46+ strategy . db = my_db
47+ expected_hash = { 'database' => 'one' ,
48+ 'encoding' => 'utf8' ,
49+ 'reconnect' => true }
50+ expect ( strategy . connection_hash ) . to eq ( expected_hash )
51+
52+ strategy . db = other_db
53+ expected_hash . merge! ( 'database' => 'two' )
54+ expect ( strategy . connection_hash ) . to eq ( expected_hash )
55+ end
56+ end
57+
4158 context 'when ActiveRecord configuration contains a config for the given db' do
4259 if ::ActiveRecord . version >= Gem ::Version . new ( '6.1' )
4360 context 'ActiveRecord >= 6.1' do
Original file line number Diff line number Diff line change 1+ default : &default
2+ encoding : utf8
3+ reconnect : true
4+
5+ my_db :
6+ << : *default
7+ database : <%= "ONE".downcase %>
8+
9+ other_db :
10+ << : *default
11+ database : <%= "TWO".downcase %>
You can’t perform that action at this time.
0 commit comments