aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/railties/engine_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Move SchemaMigration to migration_contexteileencodes2019-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This PR moves the `schema_migration` to `migration_context` so that we can access the `schema_migration` per connection. This does not change behavior of the SchemaMigration if you are using one database. This also does not change behavior of any public APIs. `Migrator` is private as is `MigrationContext` so we can change these as needed. We now need to pass a `schema_migration` to `Migrator` so that we can run migrations on the right connection outside the context of a rake task. The bugs this fixes were discovered while debugging the issues around the SchemaCache on initialization with multiple database. It was clear that `get_all_versions` wouldn't work without these changes outside the context of a rake task (because in the rake task we establish a connection and change AR::Base.connection to the db we're running on). Because the `SchemaCache` relies on the `SchemaMigration` information we need to make sure we store it per-connection rather than on ActiveRecord::Base. [Eileen M. Uchitelle & Aaron Patterson]
* [#35782] Allow loading seeds without ActiveJob (~> 5.2.3)Jeremy Weathers2019-04-191-0/+30
|
* Only override async adapter when seedingBatedUrGonnaDie2019-04-091-1/+14
|
* Zeitwerk integrationXavier Noria2019-02-121-15/+17
|
* Restrict frameworks to load in engine testyuuji.yaginuma2019-02-061-4/+22
| | | | | For avoid to affect tests. Also, `action_text:install` task execute `yarn add`. This is an expensive and should be avoided if it is not needed.
* Seed database with inline ActiveJob job adapterGannon McGibbon2019-01-171-0/+12
|
* Import Action TextGeorge Claghorn2019-01-041-4/+4
|
* Import Action MailboxGeorge Claghorn2018-12-251-4/+4
|
* Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the futureRyuta Kamizono2018-07-121-1/+0
| | | | | | | We sometimes ask "✂️ extra blank lines" to a contributor in reviews like https://github.com/rails/rails/pull/33337#discussion_r201509738. It is preferable to deal automatically without depending on manpower.
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-2/+2
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Refactor migration to move migrations paths to connectioneileencodes2018-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails has some support for multiple databases but it can be hard to handle migrations with those. The easiest way to implement multiple databases is to contain migrations into their own folder ("db/migrate" for the primary db and "db/seconddb_migrate" for the second db). Without this you would need to write code that allowed you to switch connections in migrations. I can tell you from experience that is not a fun way to implement multiple databases. This refactoring is a pre-requisite for implementing other features related to parallel testing and improved handling for multiple databases. The refactoring here moves the class methods from the `Migrator` class into it's own new class `MigrationContext`. The goal was to move the `migrations_paths` method off of the `Migrator` class and onto the connection. This allows users to do the following in their `database.yml`: ``` development: adapter: mysql2 username: root password: development_seconddb: adapter: mysql2 username: root password: migrations_paths: "db/second_db_migrate" ``` Migrations for the `seconddb` can now be store in the `db/second_db_migrate` directory. Migrations for the primary database are stored in `db/migrate`". The refactoring here drastically reduces the internal API for migrations since we don't need to pass `migrations_paths` around to every single method. Additionally this change does not require any Rails applications to make changes unless they want to use the new public API. All of the class methods from the `Migrator` class were `nodoc`'d except for the `migrations_paths` and `migrations_path` getter/setters respectively.
* Add test case that active_storage:install task works within engineyuuji.yaginuma2017-12-171-0/+15
| | | | Follow up of #31391
* Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-121-6/+6
| | | | Follow up of #31390.
* Do not run `active_storage:install` when bundle install is skippedyuuji.yaginuma2017-11-081-0/+4
| | | | | | | In order to execute the `rails` command, need to run bundle install in advance. Therefore, if skipped bundle install, `rails` command may fail and should not do it.
* `rails new` runs `rails active_storage:install`bogdanvlviv2017-11-061-20/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix RuboCop offensesKoichi ITO2017-08-161-4/+4
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Railties updates for frozen string literals.Pat Allan2017-08-141-1/+1
|
* ActiveStorage:Add migrations per rails engine conventions (#30111)Dino Maric2017-08-081-2/+2
| | | | | | * Add migrations per rails engine conventions * Fix failing tests
* Make sure the test fails if the code chagesRafael Mendonça França2017-08-041-8/+10
| | | | | | | | The test was passing before because it was not being testes correctly. Now we create a different engine that is loaded before the already exising and we make sure that the first call for isolate_namespace is what takes effect.
* Do not call isolate_namespace on the applicationRafael Mendonça França2017-08-041-1/+9
| | | | | | | | | What we want to test is that two different calls to isolate_namespace with the same module doesn't change the original railtie. We can do that defining two different railties. We can't call in the application because this method is not supposed to be called in an Application class.
* Fix regression from multiple mountpoint supportDavid Rodríguez2017-07-241-0/+29
|
* Allow mounting same engine under several locationsDavid Rodríguez2017-07-051-0/+86
|
* 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
|
* Should escape meta characters in regexpRyuta Kamizono2017-05-071-9/+9
|
* assert_equal takes expectation firstAkira Matsuda2016-12-261-1/+1
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-2/+2
|
* Remove deprecated support to :text in renderRafael Mendonça França2016-10-101-12/+12
|
* 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.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-2/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-4/+4
|
* applies new string literal convention in railties/testXavier Noria2016-08-061-26/+26
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* remove unnecessary require and extendyuuji.yaginuma2016-07-311-8/+0
| | | | | | | | `rack/test` is require at the top of file. https://github.com/rails/rails/blob/master/railties/test/railties/engine_test.rb#L3 In addtion, `Rack::Test::Methods` is include in class, extend is unnecessary. https://github.com/rails/rails/blob/master/railties/test/railties/engine_test.rb#L9
* Remove unused boot_rails method and it's usagePrathamesh Sonpatki2016-07-041-1/+0
| | | | | - The `boot_rails` method from abstract_unit.rb is empty after 2abcdfd978fdcd491576a237e8c6b. - So let's remove it and its usage.
* Fix failing railties testsPrathamesh Sonpatki2016-06-181-2/+2
| | | | | | | | | | - Railties tests related to fetching asset URL started failing after the release of sprockets 3.6.1 on Travis. - This was due to the change in https://github.com/rails/sprockets/pull/311/files which changed the logic in `concat_javascript_sources` to add `;` at the end of file if the source did not end with semicolon. - Bumped up sprockets minor version and fixed the failing tests.
* reference actual class to use middlewareyuuji.yaginuma2016-06-021-1/+1
| | | | Using strings for middleware class names is deprecated in 83b767cef90abfc4c2ee9f4b451b0215501fae9a.
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-151-9/+9
| | | | | | | | 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.
* Replace `serve_static_files` in tests with `public_file_server.enabled`.Kasper Timm Hansen2015-11-041-1/+1
| | | | Forgot to do it in 748b2f9, when deprecating `serve_static_files`.
* Fix mounted engine named routes regressionMatthew Erhard2015-10-071-0/+49
| | | | | | | | | | | | | | | | | When generating the url for a mounted engine through its proxy, the path should be the sum of three parts: 1. Any `SCRIPT_NAME` request header or the value of `ActionDispatch::Routing::RouteSet#relative_url_root`. 2. A prefix (the engine's mounted path). 3. The path of the named route inside the engine. Since commit https://github.com/rails/rails/commit/44ff0313c121f528a68b3bd21d6c7a96f313e3d3, this has been broken. Step 2 has been changed to: 2. A prefix (the value of `ActionDispatch::Routing::RouteSet#relative_url_root` + the engine's mounted path). The value of `ActionDispatch::Routing::RouteSet#relative_url_root` is taken into account in step 1 of the route generation and should be ignored when generating the mounted engine's prefix in step 2. This commit fixes the regression by having `ActionDispatch::Routing::RouteSet#url_for` check `options[:relative_url_root]` before falling back to `ActionDispatch::Routing::RouteSet#relative_url_root`. The prefix generating code then sets `options[:relative_url_root]` to an empty string. This empty string is used instead of `ActionDispatch::Routing::RouteSet#relative_url_root` and avoids the duplicate `relative_url_root` value in the final result. This resolves #20920 and resolves #21459
* Test using sprockets 3Rafael Mendonça França2015-03-291-2/+2
|
* Remove deprecate `*_path` helpers in email viewsRafael Mendonça França2015-01-041-2/+2
|
* Merge pull request #17227 from claudiob/explicitly-abort-callbacksRafael Mendonça França2015-01-031-10/+5
|\ | | | | | | | | | | | | Introduce explicit way of halting callback chains by throwing :abort. Deprecate current implicit behavior of halting callback chains by returning `false` in apps ported to Rails 5.0. Completely remove that behavior in brand new Rails 5.0 apps. Conflicts: railties/CHANGELOG.md
| * Loosen test about order of initializersclaudiob2015-01-021-10/+5
|/ | | | | | | | | | | | | | This commit modifies the code (but not the purpose) of a test that checks that > initializers are executed after application configuration initializers Currently the test hard-codes the *exact* initializers that are expected to occur before a custom one. This can cause the test to fail even if the expectation still passes. This commit loosens the test by simply checking that, in the array of initializers, the custom initializers (called `dummy_initializer` in the example) is executed after the last occurrence of `load_config_initializers`.
* Merge pull request #18100 from chancancode/serve_static_filesGodfrey Chan2014-12-191-1/+1
| | | | | | Allow static asset serving from env variable (enhanced!) Conflicts: railties/CHANGELOG.md
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* :nail_care: it's -> its (see comments on 9a586ac)Godfrey Chan2014-10-181-1/+1
|
* [ci skip] A Rails engine is not a man :ok_woman:Zachary Scott2014-10-181-1/+1
|
* Dont mess with default order engines loadWashington Luiz2014-09-021-0/+36
| | | | | | | When copying migrations some engines might depend on schema from other engine so we can't blindly reverse all railties collection as that would affect the order they were originally loaded. This patch helps to only apply the order from engines specified in `railties_order`