aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/rake
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary migration deletionyuuji.yaginuma2017-11-081-4/+0
| | | | | Since isolation application is generated with the `--skip-gemfile` option, so `active_storage:install` is not executed.
* Fix `bin/rails db:migrate` with specified `VERSION`bogdanvlviv2017-11-061-2/+154
| | | | | | 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.
* `rails new` runs `rails active_storage:install`bogdanvlviv2017-11-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit `rails activestorage:install` for jdbcmysql, jdbc and shebang tests AppGeneratorTest#test_config_jdbcmysql_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/mysql_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_config_jdbc_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/jdbc_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_shebang_is_added_to_rails_file /home/ubuntu/.rbenv/versions/2.4.1/bin/ruby: no Ruby script found in input (LoadError) Prevent PendingMigrationError in tests * Run `bin/rails db:migrate RAILS_ENV=test` in test_cases before start tests to prevent PendingMigrationError * FileUtils.rm_r("db/migrate") * --skip-active-storage Fix failed tests in `railties/test/railties/engine_test.rb` Related to #30111 Imporve `SharedGeneratorTests#test_default_frameworks_are_required_when_others_are_removed` - Explicitly skip active_storage - Ensure that skipped frameworks are commented - Ensure that default frameworks are not commented Fix error `Errno::ENOSPC: No space left on device - sendfile` Since `rails new` runs `rails active_storage:install` that boots an app. Since adding Bootsnap 0312a5c67e35b960e33677b5358c539f1047e4e1 during booting an app, it creates the cache: 264K tmp/cache/bootsnap-load-path-cache 27M tmp/cache/bootsnap-compile-cache * teardown_app must remove app
* `ActiveRecord::Tasks::DatabaseTasks.load_schema` has always to establish ↵bogdanvlviv2017-10-151-0/+8
| | | | | | | | | | | | database connection When load schema from `structure.sql`, database connection isn't established. `ActiveRecord::Tasks::DatabaseTasks.load_schema` has to establish database connection since it executes ``` ActiveRecord::InternalMetadata.create_table ActiveRecord::InternalMetadata[:environment] = environment ```
* Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create wrong ↵bogdanvlviv2017-10-151-0/+39
| | | | | | | | | | | | | | | | | | | | | | ar_internal_metadata's data for a test database. Before: ``` $ RAILS_ENV=test rails dbconsole > SELECT * FROM ar_internal_metadata; key|value|created_at|updated_at environment|development|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679 ``` After: ``` $ RAILS_ENV=test rails dbconsole > SELECT * FROM ar_internal_metadata; key|value|created_at|updated_at environment|test|2017-09-11 23:14:10.815679|2017-09-11 23:14:10.815679 ``` Fixes #26731.
* Remove redundant execution of `Dir.chdir(app_path) { }` in railties' testsbogdanvlviv2017-10-082-193/+163
|
* Run in-app rails commands via fork+load where possibleMatthew Draper2017-09-046-130/+122
| | | | | While this avoids shell argument parsing, we still pass through everything in our stack.
* Make `restart` and `dev:cache` tasks work when customizing pid file pathyuuji.yaginuma2017-08-212-13/+8
| | | | | | | | | | Originally, it hard-coded pid file path. It can not be removed when customizing pid file path. But rake task can not get pid file path. Therefore, do not remove file in rake task, makes it possible to judge whether it is restart from the argument of the command and removes the file in server command. Fixes #29306
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-148-0/+16
|
* Railties updates for frozen string literals.Pat Allan2017-08-141-1/+2
|
* Fix `warning: ambiguous first argument`yuuji.yaginuma2017-07-251-1/+1
| | | | | | | | This fixes the following warning: ``` railties/test/application/rake/dbs_test.rb:265: warning: ambiguous first argument; put parentheses or a space even after `/' operator ```
* Avoid modifying frozen string in check_schema_fileEugene Kenny2017-07-231-0/+7
| | | | | | This was missed when the frozen string literal pragma was added to this file because the string is only modified when running in the context of a full Rails app, which wasn't covered by the test suite.
* Move test related to `tmp:clear` task to `tmp_test.rb`yuuji.yaginuma2017-07-021-0/+7
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-028-8/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-028-0/+8
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-017-0/+7
| |
* | Clear screenshots files in `tmp:clear` taskyuuji.yaginuma2017-06-271-0/+36
|/ | | | | | | | | If system test fails, it creates screenshot under `tmp/screenshots`. https://github.com/rails/rails/blob/34fe2a4fc778d18b7fe6bdf3629c1481bee789b9/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb#L45 But currently, screenshot files is not cleared by `tmp:clear` task. This patch make clears screenshot files with `tmp:clear` task as well as other tmp files.
* Also raise error when VERSION is nilRafael Mendonça França2017-04-271-0/+6
| | | | Fix #28905
* Add additional raise UnknownMigrationVersionErrorbogdanvlviv2017-04-191-1/+31
| | | | | Raise error on the movement of migrations when the current migration does not exist.
* Fix `bin/rails db:forward` first migrationbogdanvlviv2017-04-191-0/+25
|
* Remove duplicated "test" prefixRyuta Kamizono2017-04-071-3/+3
|
* Fixes #28359Philippe Guay2017-03-261-0/+16
| | | | | | | | | | | | | | | | Add stronger assertions to rake migration tasks to make sure the user is providing a numeric VERSION An empty string was getting converted to version = 0. This would in turn pass the presence check. Address linting warning Add test for rake task and refactor code to meet expectations In particular passing VERSION=0 should not raise an error. Addressed Comments for PR #28485. Trimmed empty lines + change of wording for error message Adjust test for change of wording in error message Change condition to follow rails idioms
* Remove unused requireRyuta Kamizono2017-02-122-2/+0
| | | | | | These files are not using `strip_heredoc`. Closes #27976
* update CREATE TABLE statements generated by `sqlite3` commandyuuji.yaginuma2017-01-191-2/+2
| | | | | | | From SQLite 3.16.0, `IF NOT EXISTS` set to CREATE TABLE statements. Ref: https://www.sqlite.org/src/info/c7021960f5c070fb Fixes #27635.
* clear all environments log files by defaultyuuji.yaginuma2016-10-141-0/+33
| | | | | | | In #22703, `log:clear` task has been changed to clear only standard environment log files. However, it is often to add a non-standard environment(e.g. "staging"). Therefore, I think than it is better to clear all environments log files by default.
* use rails command in restart task testyuuji.yaginuma2016-09-191-7/+7
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-062-53/+53
|
* applies new string literal convention in railties/testXavier Noria2016-08-066-78/+78
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Merge pull request #25652 from prathamesh-sonpatki/rm-boot-railsGuillermo Iguaran2016-07-085-5/+0
|\ | | | | Remove unused boot_rails method and it's usage
| * Remove unused boot_rails method and it's usagePrathamesh Sonpatki2016-07-045-5/+0
| | | | | | | | | | - The `boot_rails` method from abstract_unit.rb is empty after 2abcdfd978fdcd491576a237e8c6b. - So let's remove it and its usage.
* | Fix test to try `spec/` directory as opposed to `app/spec` which I hadJohn Meehan2016-07-051-2/+2
| | | | | | | | | | | | accidently set it to. Made the change and test still passes.
* | removed extra blank lineJohn Meehan2016-07-051-1/+0
| |
* | Allow rake notes to work with other directories.John Meehan2016-07-051-0/+13
|/ | | | | | | Additional directories can be added using SourceAnnotationExtractor::Annotation.register_directories("spec", "other_dir") Result: rake notes will now extract notes from these directories.
* - using rails dev:cache instead of rake dev:cacheMohit Natoo2016-04-221-1/+1
|
* Fixed assertions with regex used in dbs testsVipul A M2016-04-191-2/+2
|
* Added notice when a database is successfully created or dropped.bogdanvlviv2016-04-171-2/+2
|
* Fix rails restart issue with PumaPrathamesh Sonpatki2016-03-302-0/+18
| | | | | | | | | | | | | | | - We need to pass the restart command to Puma so that it will use it while restarting the server. - Also made sure that all the options passed by user while starting the server are used in the generated restart command so that they will be used while restarting the server. - Besides that we need to remove the server.pid file for the previous running server because otherwise Rack complains about it's presence. - We don't care if the server.pid file does not exist. We only want to delete it if it exists. - This also requires some changes on Puma side which are being tracked here - https://github.com/puma/puma/pull/936. - Fixes #23910.
* - using rails dev:cache instead of rake dev:cache in test caseMohit Natoo2016-03-041-1/+1
|
* revert dev:cache to rake task, fixes #23410Scott Bronson2016-02-071-0/+34
|
* Shorten ActiveRecord::InternalMetadata.table_name to ar_internal_metadataYasuo Honda2016-02-011-2/+2
| | | | to support Oracle database which only supports 30 byte identifier length
* Be consistent in testing outputs from railties test and use /bin/rails ↵Vipul A M2016-01-243-56/+56
| | | | | | everywhere(the default behaviour now) instead of mix of /bin/rake /bin/rails everywhere [Ryo Hashimoto & Vipul A M]
* Fixing tests and re-locating error checking.schneems2016-01-081-2/+2
|
* Prevent destructive action on production databaseschneems2016-01-071-3/+3
| | | | | | | This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd. It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large. To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in `protected_environments` and abort. There is a manual escape valve to force this check from happening with environment variable `DISABLE_DATABASE_ENVIRONMENT_CHECK=1`.
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-151-3/+3
| | | | | | | | 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.
* Add Rails command infrastructure and encapsulate development cachingChuck Callebs2015-12-041-35/+0
|
* Remove warningsRafael Mendonça França2015-12-041-4/+4
|
* Make `db:migrate:status` to render `1_some.rb` format migrate files.yui-knk2015-11-021-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `1_valid_people_have_last_names.rb` and `20150823202140_create_users.rb` are valid migration file name. But `1_valid_people_have_last_names.rb` is rendered as `********** NO FILE **********` when `rake db:migrate:status`. Fix to this bug, this commit includes * define some API private methdos and a Constant `match_to_migration_filename?`, `parse_migration_filename`, and `MigrationFilenameRegexp` * use these methods in `db:migrate:status` task Example: These files are in `db/migrate` * 1_valid_people_have_last_names.rb * 20150819202140_irreversible_migration.rb * 20150823202140_add_admin_flag_to_users.rb * 20150823202141_migration_tests.rb * 2_we_need_reminders.rb * 3_innocent_jointable.rb we can migrate all of them. Before ```shell $ bundle exec rake db:migrate:status ... Status Migration ID Migration Name -------------------------------------------------- up 001 ********** NO FILE ********** up 002 ********** NO FILE ********** up 003 ********** NO FILE ********** up 20150819202140 Irreversible migration up 20150823202140 Add admin flag to users up 20150823202141 Migration tests ``` After ```shell $ bundle exec rake db:migrate:status ... Status Migration ID Migration Name -------------------------------------------------- up 001 Valid people have last names up 002 We need reminders up 003 Innocent jointable up 20150819202140 Irreversible migration up 20150823202140 Add admin flag to users up 20150823202141 Migration tests ```
* Exit with non-zero status when db:drop failsJay Hayes2015-10-201-0/+10
| | | | | | | | | | | * If the drop task fails for a reason other than the database not existing, processing should end. This is indicated by a non-zero exit status. * Since the backtrace is already printed to screen, we forgo printing it again by using an explicit call to `exit`. * :warning: This modifies the behavior of the db:create task slightly in that the stack trace is no longer printed by default. If the `--trace` option is used, it will print the trace _after_ the error message.