| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
It's worth considering whether we should hide these by default, but I'm kinda thinking no. It's very reasonable that someone would want to call these directly, so they should be documented.
|
|
|
|
|
|
|
|
| |
Rather than protecting from forgery in the generated
ApplicationController, add it to ActionController::Base by config. This
configuration defaults to false to support older versions which have
removed it from their ApplicationController, but is set to true for
Rails 5.2.
|
| |
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
- This test was present in https://github.com/rails/rails/pull/27089
but not present on master, may be removed in merge commit?
- There was discussion about moving this to `application/rake_test` so
may be this happened in merge commit.
- https://github.com/rails/rails/pull/27089#discussion_r88731157
|
|
|
|
|
|
|
|
|
|
| |
#26606
Rails routes (even rake routes in previous versions) output showed incorrect routes when an application use resource :controller, implying that edit_controller_path match with controller#show.
The order of the output has changed to correct this. View #26606 for more information.
Added a test case, change unit test in rake to expect the new output.
Since the output of resource :controller is changing, the string spected of the railties/test/application/rake_test.rb test_rails_routes_with_controller_environment had to be modified.
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
| |
- The `boot_rails` method from abstract_unit.rb is empty after 2abcdfd978fdcd491576a237e8c6b.
- So let's remove it and its usage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When changing the generated integration tests to assert redirects with
an absolute path this redirection check in `assert_redirected_to` against
the absolute response location would now pass:
https://github.com/rails/rails/blob/af245aaf3a1c447752a1b5895adddc66e5f73c00/actionpack/lib/action_dispatch/testing/assertions/response.rb#L55
Thus we'd break early instead of hitting `assert_operator` and have
2 fewer assertions per `assert_redirected_to` as `assert_operator`
is composed of 2 assertions internally:
https://github.com/seattlerb/minitest/blob/4e146b1515b19a5c474e39c174b037510f6dbc6e/lib/minitest/assertions.rb#L254-L258
Deduct 2 assertions for 2 redirects taking the expected count down by 4
in total for the two failing tests.
|
|\
| |
| | |
remove unnessary option setting from test runner
|
| |
| |
| |
| |
| | |
In order to prevent `OptionParser::ParseError` when specify the rake options to
`routes` task.
|
|/
|
|
| |
- Followup of https://github.com/rails/rails/pull/24709.
|
|
|
|
| |
Follow up to #24050.
|
| |
|
|
|
|
| |
of `rake routes`
|
|
|
|
| |
In order to eliminate the dependecy of CoffeeScript.
|
|
|
|
| |
(e.g. `rails:update` and `rails:template` tasks is renamed to `app:update` and `app:template`.)
|
|
|
|
| |
This also marks Action Cable routes as internal to Rails.
|
|\
| |
| | |
Fix routes to match verb and URL path with -g option also.
|
| | |
|
|/
|
|
|
|
|
| |
It has been changed to require `belongs_to` by default in Rails 5.
Therefore in order to pass the controller test, have association of set to fixtures.
Fixes #23384
|
|
|
|
|
| |
For other task has become to use the rails command at doc and test,
I think that routes task also it is better to use the rails command.
|
|
|
|
|
|
|
|
|
|
| |
Add two options: `-c` and `-g`.
`-g` option returns the urls name, verb and path fields that match the pattern.
`-c` option returns the urls for specific controller.
Fixes #18902, and Fixes #20420
[Anton Davydov & Vipul A M]
|
|
|
|
|
|
| |
everywhere(the default behaviour now) instead of mix of /bin/rake /bin/rails everywhere
[Ryo Hashimoto & Vipul A M]
|
|
|
|
|
|
|
|
|
| |
This removes the following warnings.
```
test/application/rake_test.rb:33: warning: ambiguous first argument; put parentheses or a space even after `/' operator
test/application/rake_test.rb:43: warning: ambiguous first argument; put parentheses or a space even after `/' operator
```
|
|\
| |
| | |
Prevent destructive action on production database
|
| |
| |
| |
| |
| |
| |
| | |
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`.
|
| |
| |
| |
| | |
Application* parent
|
|\ \
| |/
|/| |
Introduce ApplicationRecord, an Active Record layer supertype
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It's pretty common for folks to monkey patch `ActiveRecord::Base` to
work around an issue or introduce extra functionality. Instead of
shoving even more stuff in `ActiveRecord::Base`, `ApplicationRecord` can
hold all those custom work the apps may need.
Now, we don't wanna encourage all of the application models to inherit
from `ActiveRecord::Base`, but we can encourage all the models that do,
to inherit from `ApplicationRecord`.
Newly generated applications have `app/models/application_record.rb`
present by default. The model generators are smart enough to recognize
that newly generated models have to inherit from `ApplicationRecord`,
but only if it's present.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Running railties generated app tests in development env can cause unintended
consequences. The environments are different and tests aren't meant to be
run in development mode.
The changes to the generator exposed this issue where the random test
order in the generated apps could cause problems when those tests are
run in development mode.
Particularly we saw failures in `railties/test/application/rake_test.rb`
generated apps that used the scaffold to create applications and then
run the migration and immediately run the tests. The error we saw was
`ActiveRecord::RecordNotFound: Couldn't find User with 'id'=980190962`
and seemed to only occur if the destroy test ran first. I'm not entirely
sure _why_ this causes that error to be thrown but I believe it is
related to the environments being different.
|
| |
|
|
|
|
|
| |
We recommend using the `bin/` executables in our docs and guides.
Let's make sure that our tests execute the same code path.
|
|
|
|
| |
This looks to be just out of sync tests
|
| |
|
| |
|
|
|
|
| |
See #20299.
|
|
|
|
|
| |
- Based on DHH's suggestion about deprecating `assigns` in
https://github.com/rails/rails/pull/18305#issuecomment-68605166.
|
|
|
|
|
|
|
|
| |
* Jobs generated now inherent from ApplicationJob
* ApplicationJob inherents from ActiveJob::Base
* Added entry to changelog
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
|
|
|
|
| |
Deprecate `required` option in favor of `optional` for belongs_to.
|
|
|
|
|
| |
`rake test:load_structure` already uses `SCHEMA` and there's no
need to maintain two different env vars.
|
|
|
|
|
|
|
|
|
|
|
| |
Templates could rely on irregular inflections or external libraries for
instance so we should load the application's initializers when running
the rails:template task.
The introducing commit of this feature is f7f11361 ; the initializers
have never been loaded invoking this task.
Fixes #12133.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Move check from generated helper to test_help.rb, so that all
applications can benefit
* Rather than just raising when the test schema has pending migrations,
try to load in the schema and only raise if there are pending
migrations afterwards
* Opt out of the check by setting
config.active_record.maintain_test_schema = false
* Deprecate db:test:* tasks. The test helper is now fully responsible
for maintaining the test schema, so we don't need rake tasks for this.
This is also a speed improvement since we're no longer reloading the
test database on every call to "rake test".
|