@@ -40,6 +40,7 @@ class ChangeGeneratorTest < Rails::Generators::TestCase
40
40
assert_match "adapter: postgresql" , content
41
41
assert_match "database: tmp_production" , content
42
42
assert_match "host: <%= ENV[\" DB_HOST\" ] %>" , content
43
+ assert_match "cache:\n <<: *production_primary" , content
43
44
end
44
45
45
46
assert_file ( "Gemfile" ) do |content |
@@ -85,6 +86,7 @@ class ChangeGeneratorTest < Rails::Generators::TestCase
85
86
assert_file ( "config/database.yml" ) do |content |
86
87
assert_match "adapter: mysql2" , content
87
88
assert_match "database: tmp_production" , content
89
+ assert_match "cache:\n <<: *production_primary" , content
88
90
end
89
91
90
92
assert_file ( "Gemfile" ) do |content |
@@ -129,6 +131,7 @@ class ChangeGeneratorTest < Rails::Generators::TestCase
129
131
assert_file ( "config/database.yml" ) do |content |
130
132
assert_match "adapter: sqlite3" , content
131
133
assert_match "storage/development.sqlite3" , content
134
+ assert_match "cache:\n <<: *default" , content
132
135
end
133
136
134
137
assert_file ( "Gemfile" ) do |content |
@@ -186,9 +189,9 @@ class ChangeGeneratorTest < Rails::Generators::TestCase
186
189
187
190
assert_equal expected_mariadb_config , compose_config [ "services" ] [ "mariadb" ]
188
191
assert_includes compose_config [ "volumes" ] . keys , "mariadb-data"
189
-
190
- assert_solid_cache_migration here : "db/migrate" , not_here : "db/cache/migrate"
191
192
end
193
+
194
+ assert_solid_cache_migration here : "db/migrate" , not_here : "db/cache/migrate"
192
195
end
193
196
194
197
test "change from versioned gem to other versioned gem" do
@@ -198,6 +201,7 @@ class ChangeGeneratorTest < Rails::Generators::TestCase
198
201
assert_file ( "config/database.yml" ) do |content |
199
202
assert_match "adapter: mysql2" , content
200
203
assert_match "database: tmp_production" , content
204
+ assert_match "cache:\n <<: *production_primary" , content
201
205
end
202
206
203
207
assert_file ( "Gemfile" ) do |content |
@@ -223,6 +227,21 @@ class ChangeGeneratorTest < Rails::Generators::TestCase
223
227
assert_not_includes compose_config . keys , "volumes"
224
228
end
225
229
end
230
+
231
+ test "change without solid cache" do
232
+ rm_r ( File . expand_path ( "db/cache/migrate" , destination_root ) )
233
+
234
+ run_generator [ "--to" , "postgresql" ]
235
+
236
+ assert_file ( "config/database.yml" ) do |content |
237
+ assert_match "adapter: postgresql" , content
238
+ assert_match "database: tmp_production" , content
239
+ assert_match "host: <%= ENV[\" DB_HOST\" ] %>" , content
240
+ assert_no_match "cache:\n <<: *production_primary" , content
241
+ end
242
+
243
+ assert_no_solid_cache_migration
244
+ end
226
245
end
227
246
end
228
247
end
0 commit comments