aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
Commit message (Collapse)AuthorAgeFilesLines
* Make the `static_index` config part of the `config.public_server` configYuki Nishijima2015-11-161-4/+4
| | | | Also call it `public_server.index_name` so it'll make more sense.
* Prefer Minitest's location for test failures.Kasper Timm Hansen2015-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When running tests, the Rails test runner would report the start of the test method as the test failure. For this test: ```ruby 1 require 'test_helper 2 3 class BunnyTest < ActiveSupport::TestCase 4 test "something failing" do 5 assert false, 'This failed' 6 end 7 end ``` The runner outputs 5 instead of 4: ``` ............................................F This failed bin/rails test test/models/bunny_test.rb:5 ........ ```
* Replace `serve_static_files` in tests with `public_file_server.enabled`.Kasper Timm Hansen2015-11-043-4/+4
| | | | Forgot to do it in 748b2f9, when deprecating `serve_static_files`.
* Add enabled flag to the public file server.Kasper Timm Hansen2015-11-031-6/+16
| | | | | | | | As discussed in https://github.com/rails/rails/pull/19135#issuecomment-153385986. Replaces `serve_static_files` to unify the static options under the `public_file_server` wing. Deprecates `serve_static_files` accessors, but make them use the newer config internally.
* 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 ```
* rails/application: allow passing an env to config_forSimon Eskildsen2015-10-301-0/+16
|
* raise `ArgumentError` when `SECRET_KEY_BASE` is an integerArun Agrawal2015-10-271-0/+13
| | | | | | | If `SECRET_KEY_BASE` or other `secret` gets passed as other then string we need to raise `ArgumentError` to know that it's a wrong argument. Closes #22072
* Merge pull request #19924 from iamvery/db-tasks-exit-statusSean Griffin2015-10-261-0/+52
|\ | | | | | | Explicitly exit with status "1" for create and drop failures
| * 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.
| * Exit with non-zero status when db:create failsJay Hayes2015-10-201-0/+17
| | | | | | | | | | | | | | | | | | | | | | * If the create task fails for a reason other than the database already 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.
| * Fix test of drop failureJay Hayes2015-10-201-4/+1
| | | | | | | | | | | | | | * Previously the sqlite3 adapter could not "fail" on drop. Now an error is raised when no file exists. * Also updates purge to be resilient of drop failures. This is how purge is expected to behave.
| * Add tests to verify exit status for create/drop failuresJay Hayes2015-10-201-0/+28
| | | | | | | | | | | | | | | | | | | | * Running the db:create task when the database already exists isn't really an error case. That is processing may proceed in this case because the database exists as requested. So let's validate that behavior with a test. * Likewise, if the database doesn't exist when running the db:drop task processing may continue as the requested condition is already met. Thus a test.
* | Tweaked wording used in some tests.Sebastian McKenzie2015-10-251-3/+3
|/
* Merge pull request #19135 from yuki24/access-control-supportJeremy Daer2015-10-132-0/+27
|\ | | | | | | Add basic support for access control headers to ActionDispatch::Static
| * Add the ability of returning arbitrary headers to ActionDispatch::StaticYuki Nishijima2015-06-132-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now ActionDispatch::Static can accept HTTP headers so that developers will have control of returning arbitrary headers like 'Access-Control-Allow-Origin' when a response is delivered. They can be configured through `#config.public_file_server.headers`: config.public_file_server.headers = { "Cache-Control" => "public, max-age=60", "Access-Control-Allow-Origin" => "http://rubyonrails.org" } Also deprecate `config.static_cache_control` in favor of `config.public_file_server.headers`.
* | Merge pull request #17388 from akampjes/masterArthur Nogueira Neves2015-10-121-0/+11
|\ \ | | | | | | ActionMailer https on URL with force_ssl = true
| * | ActionMailer https on URL with force_ssl = trueAndrew Kampjes2015-08-141-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `config.force_ssl = true` will set config.action_mailer.default_url_options = { protocol: 'https' } If you have turned on force_ssl, and then gone to the effort of setting config.action_mailer.default_url_options = {host: 'example.com'} then you are probably pointing people back to your current app and want https on that too.
* | | Refactor create_test_file to take a pass option.Kasper Timm Hansen2015-10-071-31/+7
| | | | | | | | | | | | Lets us cut the verbose and straight up duplicated setup in 3 tests down to one line.
* | | Hide Minitest's aggregated results if outputting inline.Kasper Timm Hansen2015-10-071-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'd see the failures and errors reported after the run, which is needless, when we've already reported them. Turns: ``` .......................................S....................F This failed bin/rails test test/models/bunny_test.rb:14 .... Finished in 0.100886s, 1020.9583 runs/s, 1001.1338 assertions/s. 2) Failure: BunnyTest#test_something_failing [/Users/kasperhansen/Documents/code/collection_caching_test/test/models/bunny_test.rb:15]: This failed 103 runs, 101 assertions, 1 failures, 0 errors, 1 skips You have skipped tests. Run with --verbose for details. ``` Into: ``` ...................S.......................................F This failed bin/rails test test/models/bunny_test.rb:14 ...................... Finished in 0.069910s, 1473.3225 runs/s, 1444.7143 assertions/s. 103 runs, 101 assertions, 1 failures, 0 errors, 1 skips ```
* | | Revert "removing Rack::Runtime from the default stack."Aaron Patterson2015-10-031-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 37423e4ff883ad5584bab983aceb4b2b759a1fd8. Jeremy is right that we shouldn't remove this. The fact is that many engines are depending on this middleware to be in the default stack. This ties our hands and forces us to keep the middleware in the stack so that engines will work. To be extremely clear, I think this is another smell of "the rack stack" that we have in place. When manipulating middleware, we should have meaningful names for places in the req / res lifecycle **not** have engines depend on a particular constant be in a particular place in the stack. This is a weakness of the API that we have to figure out a way to address before removing the constant. As far as timing attacks are concerned, we can reduce the granularity such that it isn't useful information for hackers, but is still useful for developers.
* | | removing Rack::Runtime from the default stack.Aaron Patterson2015-10-021-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The runtime header is a potential target for timing attacks since it returns the amount of time spent on the server (eliminating network speed). Total time is also not accurate for streaming responses. The middleware can be added back via: ```ruby config.middleware.ues ::Rack::Runtime ```
* | | Merge pull request #21794 from ↵Jeremy Daer2015-09-293-156/+205
|\ \ \ | | | | | | | | | | | | | | | | jeremy/sprockets/move-asset-manifest-from-toplevel-to-config-subdir Eliminate overlapping `app/assets` load path
| * | | Eliminate overlapping `app/assets` load pathJeremy Daer2015-09-293-156/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move `app/assets/manifest.js` to `app/assets/config/manifest.js`. Avoid the suggestion that you can/should deep-link `stylesheets/foo`. * Pull in all toplevel stylesheets and JavaScripts, not just `application.js` and `.css`. Demonstrate how to use `link_directory` with a specified `.js`/`.css` type. * Fix RAILS_ENV handling in assets tests. * Shush warnings spam from third-party libs that distract from tests.
* | | | Add fail fast to test runner.Kasper Timm Hansen2015-09-291-0/+15
| | | | | | | | | | | | | | | | | | | | Passing `--fail-fast` to the test runner will now abort the test run on the first failure. The run continues on any unexpected errors.
* | | | Add inline failure reporting to test runner.Kasper Timm Hansen2015-09-281-0/+15
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Any failures or errors will be reported inline during the run by default. Skipped tests will be reported if run in verbose mode. Any result is output with failure messages and a rerun snippet for that test. Rerun snippets won't be output after a run, unless `--defer-output` is passed.
* | | Fix test that was failing because of typoeileencodes2015-09-271-1/+1
| | | | | | | | | | | | | | | Here `app` needed to be `get` because we're getting a route. This fixes the typo so the test passes.
* | | Add missing routing tests for info controllerAditya Kapoor2015-09-271-0/+12
| | | | | | | | | | | | | | | | | | Vaguely related to #21605 where I proposed to remove index route since it was redirecting to the 'routes' action, but this was kept so I thought it made sense to add some tests regarding this.
* | | Fix typo in configuration test descritive > descriptive [ci skip]amitkumarsuroliya2015-09-261-1/+1
| | |
* | | mostly remove the ParamsParser middlewareAaron Patterson2015-09-181-2/+0
| | | | | | | | | | | | | | | This can still be added to the middleware stack, but is really not necessary. I'll follow up with a commit that deprecates the constant
* | | File encoding is defaulted to utf-8 in Ruby >= 2.1Akira Matsuda2015-09-181-1/+0
| | |
* | | Fix displaying mailer previews on non local requests.Wojciech Wnętrzak2015-09-171-1/+1
| | | | | | | | | | | | | | | When config `action_mailer.show_previews` is set, previews are displayed regardless of local request check.
* | | raise LoadError when a non-existent file or directory is specified to the ↵yuuji.yaginuma2015-09-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | test runner Currently, if a file or directory that does not exist was specified in the test runner, that argument is ignored. This commit has been modified to cause an error if there is no file or directory.
* | | remove unused require ‘set’NehaGautam2015-08-251-1/+0
| | |
* | | Migrate to Sprockets 4.Andrei Istratii2015-08-192-14/+19
|/ /
* | Merge pull request #21124 from kirs/feature/reload-i18nKasper Timm Hansen2015-08-101-0/+73
|\ \ | | | | | | Reload I18n.load_path in development
| * | Reload I18n locales in developmentKir Shatrov2015-08-101-0/+73
| | |
| * | Revert "test runner should crash with non existing file argument."Yves Senn2015-08-031-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 465f0fbca3d4a1c269038b84ec9cc248fdab5fab. This breaks some cases where non file / directory arguments are passed to the runner (for example db:migrate). I still think that we can get this to work. From what I can tell there is no reason why db:migrate is passed along to `Minitest.run`. I'll revert and investigate possible solutions.
| * | test runner should crash with non existing file argument.Yves Senn2015-08-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Before this patch, using `bin/rails test` with a non existing file or directory argument would silently swallow the argument and run the whole test suite. After the patch the command fails with `cannot load such file --`.
* | | Add rake dev:cache task to enable dev mode caching.Chuck Callebs2015-08-041-0/+35
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Taken from @Sonopa's commits on PR #19091. Add support for dev caching via "rails s" flags. Implement suggestions from @kaspth. Remove temporary cache file if server does not have flags. Break at 80 characters in railties/CHANGELOG.md Remove ability to disable cache based on server options. Add more comprehensive options: --dev-caching / --no-dev-caching
* | Fix rake/notes_testschneems2015-07-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | Presumably due to https://github.com/rails/sprockets-rails/pull/265 sprockets was trying to load the "scss" gem but it isn't in the gemfile: ``` ApplicationTests::RakeTests::RakeNotesTest#test_register_a_new_extension: LoadError: cannot load such file -- sass ``` If we use an empty precompile list, it won't try to load sass.
* | Fix reported regression rails/sprockets-rails#265schneems2015-07-291-0/+1
| | | | | | | | We can prevent the UglifierCompressor from being instantiated prematurely by setting precompile to an empty array in this test.
* | Make digest cache work in development.Kasper Timm Hansen2015-07-181-0/+63
| | | | | | | | | | | | Avoid computing the same fragment digest many times when looping over templates. The cache is cleared on every request so template changes are still picked up.
* | Rely on the load interlock for non-caching reloads, tooMatthew Draper2015-07-091-7/+7
| |
* | Soften the lock requirements when eager_load is disabledMatthew Draper2015-07-091-4/+21
| | | | | | | | | | We don't need to fully disable concurrent requests: just ensure that loads are performed in isolation.
* | `dump_schema_after_migration` applies migration tasks other than db:migrateYves Senn2015-06-301-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Closes #20743. The task `db:_dump` now only dumps the schema if `ActiveRecord::Base.dump_schema_after_migration` is true. This has effects: - `db:migrate:up` - `db:migrate:down` - `db:forward` - `db:rollback`
* | tests, railties tests should use `bin/` executables when possible.Yves Senn2015-06-309-121/+121
|/ | | | | We recommend using the `bin/` executables in our docs and guides. Let's make sure that our tests execute the same code path.
* Fix failing tests for Rails-APISean Griffin2015-06-111-1/+1
| | | | This looks to be just out of sync tests
* Use new hash syntaxSantiago Pastorino2015-06-111-1/+1
|
* Add test to show api only apps allow overriding generator optionsSantiago Pastorino2015-06-111-0/+16
|
* config.api_only = true implies config.generators.api_only = trueSantiago Pastorino2015-06-112-2/+1
|