diff options
author | utilum <oz@utilum.com> | 2018-04-16 22:17:45 +0200 |
---|---|---|
committer | utilum <oz@utilum.com> | 2018-04-16 22:19:07 +0200 |
commit | 74982a1be5dc040a16c5bc6d84f666b9fbdd445a (patch) | |
tree | 03d3db8068c59d4ade3c4a589b60ce3cf8594fb2 /railties/test | |
parent | 37b373a8d2a1cd132bbde51cd5a3abd4ecee433b (diff) | |
download | rails-74982a1be5dc040a16c5bc6d84f666b9fbdd445a.tar.gz rails-74982a1be5dc040a16c5bc6d84f666b9fbdd445a.tar.bz2 rails-74982a1be5dc040a16c5bc6d84f666b9fbdd445a.zip |
Fix test to allow IF NOT EXISTS in structure:dump
Before:
```
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
$ ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/rake/multi_dbs_test.rb
Run options: --seed 28744
F
Failure:
ApplicationTests::RakeTests::RakeMultiDbsTest#test_db:migrate_and_db:structure:dump_and_db:structure:load_works_on_all_databases [test/application/rake/multi_dbs_test.rb:70]:
Expected /CREATE TABLE \"books\"/ to match "CREATE TABLE IF NOT EXISTS \"schema_migrations\" (\"version\" varchar NOT NULL PRIMARY KEY);\nCREATE TABLE IF NOT EXISTS \"ar_internal_metadata\" (\"key\" varchar NOT NULL PRIMARY KEY, \"value\" varchar, \"created_at\" datetime NOT NULL, \"updated_at\" datetime NOT NULL);\nCREATE TABLE IF NOT EXISTS \"books\" (\"id\" integer PRIMARY KEY AUTOINCREMENT NOT NULL, \"title\" varchar, \"created_at\" datetime NOT NULL, \"updated_at\" datetime NOT NULL);\nCREATE TABLE sqlite_sequence(name,seq);\nINSERT INTO \"schema_migrations\" (version) VALUES\n('20180416201805');\n\n\n".
```
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/rake/multi_dbs_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/test/application/rake/multi_dbs_test.rb b/railties/test/application/rake/multi_dbs_test.rb index 43a433d40f..da5ae8376a 100644 --- a/railties/test/application/rake/multi_dbs_test.rb +++ b/railties/test/application/rake/multi_dbs_test.rb @@ -67,8 +67,8 @@ module ApplicationTests else schema_dump = File.read("db/#{format}.sql") schema_dump_animals = File.read("db/animals_#{format}.sql") - assert_match(/CREATE TABLE \"books\"/, schema_dump) - assert_match(/CREATE TABLE \"dogs\"/, schema_dump_animals) + assert_match(/CREATE TABLE (?:IF NOT EXISTS )?\"books\"/, schema_dump) + assert_match(/CREATE TABLE (?:IF NOT EXISTS )?\"dogs\"/, schema_dump_animals) end rails "db:#{format}:load" |