aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Remove Mocha from Gemfileutilum2018-08-132-6/+0
| | | | _Q.E.F._
* Add method_call_assertions and use them instead of Mochautilum2018-08-136-36/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Six Mocha calls prove quite resistant to Minitestification. For example, if we replace ``` ActiveRecord::Associations::HasManyAssociation .any_instance .expects(:reader) .never ``` with `assert_not_called`, Minitest wisely raises ``` NameError: undefined method `reader' for class `ActiveRecord::Associations::HasManyAssociation' ``` as `:reader` comes from a deeply embedded abstract class, `ActiveRecord::Associations::CollectionAssociation`. This patch tackles this difficulty by adding `ActiveSupport::Testing::MethodCallAsserts#assert_called_on_instance_of` which injects a stubbed method into `klass`, and verifies the number of times it is called, similar to `assert_called`. It also adds a convenience method, `assert_not_called_on_instance_of`, mirroring `assert_not_called`. It uses the new method_call_assertions to replace the remaining Mocha calls in `ActiveRecord` tests. [utilum + bogdanvlviv + kspath]
* Stub with Minitest and test with MethodCallAssertionsutilum2018-08-133-17/+30
|
* Merge pull request #33597 from sikachu/update-coffeelintGuillermo Iguaran2018-08-121-1/+1
|\ | | | | Update coffeelint to 2.1.0
| * Update coffeelint to 2.1.0Prem Sichanugrist2018-08-131-1/+1
|/ | | | | | | | | | | There was a warning when running `npm install` in Action View: coffee-script@1.11.1: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) We are not requiring `coffee-script` explicitly, but `coffeelint` does. The latest version, 2.1.0, already fix the dependency package name, so we should upgrade to it to suppress the warning.
* Merge pull request #33590 from bogdanvlviv/follow-up-33563-33474George Claghorn2018-08-121-7/+6
|\ | | | | Update "Active Record Migrations" guide [ci skip]
| * Clarify "Old Migrations" in "Active Record Migrations" guide [ci skip]bogdanvlviv2018-08-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | - Name rails app' files relatively to its root - `structure.sql` => `db/structure.sql` - `schema.rb` => `db/schema.rb` - Clarify rails commands - `db:migrate` => `rails db:migrate` - `db:migrate:status` => `rails db:migrate:status` - Add `/` to the end of `db/migrate` in order to express that it is directory and to keep consistency with `db/migrate/` above. Follow up #33474
| * Clarify note that SQLite3 adapter doesn't support `add_foreign_key` [ci skip]bogdanvlviv2018-08-121-3/+2
| | | | | | | | | | | | Context https://github.com/rails/rails/pull/33563#discussion_r208891486. Follow up #33563
* | Merge pull request #32937 from assain/add-purpose-to-cookiesKasper Timm Hansen2018-08-128-23/+218
|\ \ | | | | | | Add Purpose Metadata to Cookies
| * | Purpose Metadata For Signed And Encrypted CookiesAssain2018-08-128-23/+218
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Purpose metadata prevents cookie values from being copy-pasted and ensures that the cookie is used only for its originally intended purpose. The Purpose and Expiry metadata are embedded inside signed/encrypted cookies and will not be readable on previous versions of Rails. We can switch off purpose and expiry metadata embedded in signed and encrypted cookies using config.action_dispatch.use_cookies_with_metadata = false if you want your cookies to be readable on older versions of Rails.
* | Merge pull request #33591 from bogdanvlviv/add-changelog-for-31503Eileen M. Uchitelle2018-08-121-0/+16
|\ \ | |/ |/| Add changelog entry for #31503 [ci skip]
| * Add changelog entry for #31503 [ci skip]bogdanvlviv2018-08-121-0/+16
|/ | | | Related to #31503
* Merge pull request #33474 from olivierlacan/old-migrationsRichard Schneeman2018-08-111-3/+22
|\ | | | | Document best practices with old migrations
| * Document best practices with old migrationsOlivier Lacan2018-08-031-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The copy here is of course up for discussion but it feels like we need to address the issue of old migrations in the Migration guide because other than mentioning the canonical nature of schema.rb/structure.sql or the actual database compared to migration files, it seems like more guidance would help. Here's a sample of the kinds of question people seem to often ask about old Rails migrations: - https://stackoverflow.com/questions/20119391/delete-old-migrations-files-in-a-rails-app - https://www.reddit.com/r/rails/comments/4ayosd/compacting_migrations_files_or_delete_them/ - https://stackoverflow.com/questions/4248682/is-it-a-good-idea-to-purge-old-rails-migration-files - https://stackoverflow.com/questions/707013/is-it-a-good-idea-to-collapse-old-rails-migrations - https://stackoverflow.com/questions/1981777/rails-remove-old-models-with-migrations - https://stackoverflow.com/questions/3343534/rebase-rails-migrations-in-a-long-running-project The common theme seems to be: "I've got old migrations, should I keep them around on an old project?". My personal stance is that as long as migrations run and don't take too long do so, you should keep them around since it allows people working on the Rails project with you to seamlessly upgrade their local development database without having to do a `db:drop db:schema:load` and lose all their seed data. While writing down this suggested new section it felt like I was describing a very cumbersome process that could be address with a rake task like: ```bash rails db:migrate:remove VERSION=20121201123456 ``` It rollback to the version just before `20121201123456`, delete the migration file, and run `db:migrate` to get back to the latest migration. This of course doesn't address a situation when someone would want to delete or merge all migrations prior to a certain date, which is addressed by [squasher](https://github.com/jalkoby/squasher). I'm not sure this is something we want to encourage people to do. Although I feel like with more and more production Rails apps over 5-years old, it's definitely a concern we should address.
* | Merge pull request #33563 from lzap/foreign-key-note-docRichard Schneeman2018-08-111-0/+4
|\ \ | | | | | | ActiveRecord Guide - sqlite3 foreign keys note
| * | ActiveRecord Guide - sqlite3 foreign keys noteLukas Zapletal2018-08-091-0/+4
| | |
* | | Merge pull request #33587 from bogdanvlviv/follow-up-33202Kasper Timm Hansen2018-08-112-4/+3
|\ \ \ | | | | | | | | `bundle binstubs bundler` should be executed after `bundle install`
| * | | `bundle binstubs bundler` should be executed after `bundle install`bogdanvlviv2018-08-112-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: `bundle binstubs bundler` doesn't generate `bin/bundle` for newly generated Rails app. ``` ... (snip) run bundle binstubs bundler The git source https://github.com/rails/web-console.git is not yet checked out. Please run `bundle install` before trying to start your application run bundle install Fetching https://github.com/rails/web-console.git (snip) ... ``` Related to #33202
* | | | Merge pull request #33581 from q-centrix/use-strings-on-decorator-methodKasper Timm Hansen2018-08-112-2/+2
|\ \ \ \ | | | | | | | | | | Use strings instead of symbols on calls to decorate_matching_attribute_types
| * | | | Use strings instead of symbols on calls to decorate_matching_attribute_typesDillon Welch2018-08-102-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first thing this method does is run on the argument. This change passes in a string so we don't allocate a bunch of unnecessary extra strings by calling to_s on a symbol over and over.
* | | | | Merge pull request #33588 from bogdanvlviv/follow-up-31503Kasper Timm Hansen2018-08-111-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Fix test failure
| * | | | | Fix test failurebogdanvlviv2018-08-111-1/+1
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` ... (snip) ............F Failure: JsonSerializationTest#test_as_json_should_return_a_hash_if_include_root_ in_json_is_true [/home/travis/build/rails/rails/activemodel/test/cases/serializers/json_serialization_test.rb:145]: Expected: 2006-08-01 00:00:00 UTC Actual: "2006-08-01T00:00:00.000Z" rails test home/travis/build/rails/rails/activemodel/test/cases/serializers/json_serialization_test.rb:136 (snip) ... ``` Related to #31503
* | | | | Merge pull request #33586 from vinistock/make_active_job_name_prefix_staticGeorge Claghorn2018-08-111-1/+1
|\ \ \ \ \ | |/ / / / |/| | | | Make active job name prefix static since Rails.env will always be the same
| * | | | Make active job name prefix static since Rails.env will always be the sameVinicius Stock2018-08-111-1/+1
|/ / / /
* | | | Merge pull request #31503 from bogdan/timestamp-as-jsonEileen M. Uchitelle2018-08-112-9/+14
|\ \ \ \ | | | | | | | | | | Fix AM::Serializers::JSON#as_json method for timestamps
| * | | | Fix AM::Serializers::JSON#as_json method for timestampsBogdan Gusiev2017-12-212-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | According to doc the method should return non-json compatible types as strings.
* | | | | Merge pull request #33202 from deivid-rodriguez/bundler_binstubsEileen M. Uchitelle2018-08-115-32/+29
|\ \ \ \ \ | | | | | | | | | | | | Bundler binstubs
| * | | | | Generate bundler-compatible bundler binstubDavid Rodríguez2018-06-235-6/+14
| | | | | |
| * | | | | Improve readability of some specsDavid Rodríguez2018-06-231-9/+9
| | | | | |
| * | | | | Factor out some common bundler mocking logicDavid Rodríguez2018-06-231-20/+9
| | | | | |
* | | | | | Merge pull request #33553 from ↵Eileen M. Uchitelle2018-08-111-0/+18
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | bogdanvlviv/ensure-load_schema-does_not-output-in-parallel-tests-execution Ensure that running tests in parallel doesn't display schema load output
| * | | | | | Ensure that running tests in parallel doesn't display schema load outputbogdanvlviv2018-08-081-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/rails/rails/pull/33479 changed `#load_schema` to prevent displaying schema load on running tests in parallel. We should test this in order to prevent any regression in the future. Context https://github.com/rails/rails/pull/33479#discussion_r206870727
* | | | | | | Document all Active Storage error classes [ci skip]George Claghorn2018-08-101-0/+8
| | | | | | |
* | | | | | | Add a generic base class for Active Storage exceptionsGeorge Claghorn2018-08-102-4/+14
| |_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #33292. [Andrei Makarov & George Claghorn]
* | | | | | Merge pull request #31640 from gingerlime/patch-1Richard Schneeman2018-08-101-4/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | fixes #27157 CSRF protection documentation
| * | | | | | fixes #27157 CSRF protection documentationgingerlime2018-01-051-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * removed reference to GET requests where it applies also to other HTTP verbs * updated documentation to try and better explain how CSRF protection works with XHR, and the potential exposure with CORS
* | | | | | | Extract transformersGeorge Claghorn2018-08-106-70/+146
| | | | | | |
* | | | | | | Merge pull request #33568 from mohitnatoo/perform-or-enqueueGeorge Claghorn2018-08-091-3/+3
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | perform_or_enqueue instead of enqueue_or_perform
| * | | | | | | perform_or_enqueue instead of enqueue_or_performMohit Natoo2018-08-091-3/+3
| | |_|_|_|/ / | |/| | | | |
* | | | | | | DRY up web image checks in ActiveStorage::VariantGeorge Claghorn2018-08-091-18/+24
| | | | | | |
* | | | | | | Fix a typo in Active Support's CHANGELOG [ci skip]Robin Dupret2018-08-101-1/+1
| | | | | | |
* | | | | | | Add missing instructions for FreeBSD [ci skip]Robin Dupret2018-08-091-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The development dependencies installation guides have the installation instructions for FreeBSD in other sections so let's be consistent regarding the dependencies for Active Storage setup. Also fix a few typos.
* | | | | | | Merge pull request #33566 from yahonda/use_i18n_101Ryuta Kamizono2018-08-102-0/+2
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Avoid i18n 1.1.0 for now
| * | | | | | Avoid i18n 1.1.0 for nowYasuo Honda2018-08-092-0/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | [Yasuo Honda & lsylvester]
* | | | | | Merge pull request #33554 from ↵Eileen M. Uchitelle2018-08-081-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | saveriomiroddi/sav-correct_updated_at_guide_explanation ActiveRecord Basics guide: correct explanation of the `updated_at` logic [ci skip]
| * | | | | | ActiveRecord Basics guide: correct explanation of the `updated_at` logic [ci ↵Saverio Miroddi2018-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | skip] It's misleanding/incorrect to state that `updated_at` is set on updates, since creation != update (and the column is actually set on creation, too).
* | | | | | | Merge pull request #33552 from seratch/fix-obvious-typosMatthew Draper2018-08-088-19/+19
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | Fix the obvious typos detected by github.com/client9/misspell
| * | | | | | Fix a wrong correctionKazuhiro Sera2018-08-081-1/+1
| | | | | | |
| * | | | | | Fix the obvious typos detected by github.com/client9/misspellKazuhiro Sera2018-08-088-19/+19
|/ / / / / /
* | | | | | Merge pull request #33548 from Ana06/lambda-validationRafael França2018-08-071-0/+7
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add lambdas in conditional validations