aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migrator_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix `bin/rails db:migrate` with specified `VERSION`bogdanvlviv2017-11-061-0/+20
| | | | | | Ensure that `bin/rails db:migrate` with specified `VERSION` reverts all migrations only if `VERSION` is `0`. Raise error if target migration doesn't exist.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Fix MigratorTest#test_migrator_verbositybogdanvlviv2017-04-261-1/+1
| | | | | | | Add `ActiveRecord::Migration.verbose = true` to be sure that verbose is turned on in the test. Related to #28865
* Fix `rake db:schema:load` with subdirectoriesRyuta Kamizono2017-03-051-0/+17
| | | | | | | | Related #25174. `db:schema:load` doesn't work with subdirectories like previous `db:migrate:status`. `Migrator.migration_files` should be used in `assume_migrated_upto_version` to fix the issue.
* Fix `rake db:migrate:status` with subdirectoriesRyuta Kamizono2017-03-041-0/+44
| | | | | | | | | | | | `db:migrate` supports subdirectories and have a test. https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/test/cases/migrator_test.rb#L78-L85 But `db:migrate:status` doesn't work with subdirectories. It is due to `Dir.foreach(path)` is not the same with `Dir["#{path}/**/[0-9]*_*.rb"]`. I extracted `migration_files` and sharing it in the both to fix the issue. And added tests for `db:migrate:status`.
* correctly check error messageyuuji.yaginuma2017-01-251-1/+2
| | | | | | | `assert_raise` does not check error message. However, in some tests, it seems like expecting error message checking with `assert_raise`. Instead of specifying an error message in `assert_raise`, modify to use another assert to check the error message.
* Followup of #27596, test output of "run" method as wellPrathamesh Sonpatki2017-01-071-1/+8
| | | | | | - #27596 Updated "run" and "migrate" method for returning correct value but only added test for "migrate" method. This commit adds a test for "run" as well.
* Preserve `up` and `down` return typeschneems2017-01-061-0/+14
| | | | | | In Rails 4.2 calling `ActiveRecord::Migrator.migrate` would return an array of results. Without realizing that this return type was expected I accidentally introduced a change in https://github.com/rails/rails/commit/4d60e93174a3d6d90b1a06fc7515cb5cd749a6f3 This PR preserves the previous behavior and adds a test on the return type. This will need a backport to 5.0 branch.
* `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-291-2/+2
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-4/+4
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-26/+26
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-3/+3
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-21/+21
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-151-1/+1
| | | | | | | | Apart from specific versioning support, our tests should focus on the behaviour of whatever version they're accompanying, regardless of when they were written. Application code should *not* do this.
* Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-091-2/+2
| | | | | | | | | | Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
* Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.
* tests, favor `drop_table` and `:if_exists` over raw SQL.Yves Senn2015-03-021-1/+1
| | | | | We've replaced most querues using DROP TABLE in our tests already. This patch replaces the last couple calls.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-2/+2
|
* Merge pull request #17302 from ↵Rafael Mendonça França2014-10-181-3/+3
| | | | | | claudiob/replace-slower-block-call-with-faster-yield Replace (slower) block.call with (faster) yield
* Revert "Replace (slower) block.call with (faster) yield"Zachary Scott2014-10-181-3/+3
| | | | This reverts commit 0ab075e75f58bf403f7ebe20546c7005f35db1f6.
* Replace (slower) block.call with (faster) yieldclaudiob2014-10-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Performance optimization: `yield` with an implicit `block` is faster than `block.call`. See http://youtu.be/fGFM_UrSp70?t=10m35s and the following benchmark: ```ruby require 'benchmark/ips' def fast yield end def slow(&block) block.call end Benchmark.ips do |x| x.report('fast') { fast{} } x.report('slow') { slow{} } end # => fast 154095 i/100ms # => slow 71454 i/100ms # => # => fast 7511067.8 (±5.0%) i/s - 37445085 in 4.999660s # => slow 1227576.9 (±6.8%) i/s - 6145044 in 5.028356s ```
* Reset ActiveRecord::Migration.message_count counter before start testingAkira Matsuda2014-08-291-1/+1
|
* Bring original puts back after finishing testsAkira Matsuda2014-08-291-0/+12
|
* Reset ActiveRecord::Migration.verbose to the value beforeAkira Matsuda2014-08-291-1/+2
|
* Demodulize ActiveRecord::MigratorTestAkira Matsuda2014-08-291-284/+282
|
* No need for trailing slash on migration path.Jeremy Kemper2014-04-241-1/+1
| | | | | | | Causes a double // in Dir.glob that breaks Ruby 2.2-trunk. Not really a bug, but not relevant to this test either. Originally added in ed21f0c50270139ddb6993acfdaea4586ffd09a3
* Use teardown helper method.Guo Xiang Tan2014-03-141-2/+1
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* Revert "Used Yield instead of block.call" -- this causes all of ↵David Heinemeier Hansson2013-11-141-3/+3
| | | | | | atom_feed_helper_test.rb to fail with "SystemStackError: stack level too deep". This reverts commit d3a1ce1cdc60d593de1682c5f4e3230c8db9a0fd.
* Used Yield instead of block.callKuldeep Aggarwal2013-11-151-3/+3
|
* Remove deprecated String constructor from `ActiveRecord::Migrator`.Yves Senn2013-07-041-6/+0
|
* Reset AR::Migration.verbose change to avoid depending on test run orderAkira Matsuda2013-01-081-0/+1
|
* Alias refute methods to assert_not and perfer assert_not on testsRafael Mendonça França2012-12-311-4/+4
|
* recognize migrations, in folders containing numbers and 'rb'.Yves Senn2012-12-131-0/+6
| | | | Closes #8492
* Move to the schema-migrations-metadata branch.Jeremy Kemper2012-12-091-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | Pending work on graceful app upgrades. Revert "Merge pull request #8439 from joshsusser/fixes" This reverts commit ce8ac39338f86388e70356b3a470b3ea443802ae, reversing changes made to b0e7b6f67c984d4b1502e801781ed75fad681633. Revert "Merge pull request #8431 from joshsusser/schemadump" This reverts commit 036d3e1c2b65c4b8cbd23de2e20ad67b9b756182, reversing changes made to 0c692f4d121792117b6a71e5ed590a31c3b9d12e. Revert "Merge branch 'joshsusser-master' into merge" This reverts commit 0c692f4d121792117b6a71e5ed590a31c3b9d12e, reversing changes made to 2e299fca715b083a60222a85e48f9d3b8dd8ce93. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb activerecord/test/cases/schema_dumper_test.rb
* Add metadata to schema_migrationsJosh Susser2012-12-011-3/+6
| | | | | migrated_at: timestamp when migration run fingerprint: md5 hash of migration source name: filename without version or extension
* stop more ddl changesAaron Patterson2012-01-161-0/+16
|
* stop ddl modifications for another testAaron Patterson2012-01-161-0/+10
|
* use one based indexes for the mock migrationsAaron Patterson2012-01-161-16/+16
|
* stop making ddl changes for migrator testsAaron Patterson2012-01-161-12/+78
|
* actually use the variable I created. :bomb: thanks @exvivaAaron Patterson2012-01-161-1/+1
|
* move another migrator to use sensorsAaron Patterson2012-01-161-0/+18
|
* moving verbosity tests to the migrator test, removing ddl changesAaron Patterson2012-01-161-0/+24
|
* silencing migrator tests, refactoring the migration test helperAaron Patterson2012-01-161-0/+1
|
* prefer method sensors over actual ddl changesAaron Patterson2012-01-161-0/+84
|
* testing the current version methodAaron Patterson2012-01-161-1/+26
|
* refactor schema migration table creation to the schema migration modelAaron Patterson2012-01-131-0/+1
|
* stop depending on the filesystem for interleaved migration testsAaron Patterson2012-01-131-1/+49
|