Commit Graph

60425 Commits

Author SHA1 Message Date
Yves Senn
e49237387b changelog entry for fc4c15d [ci skip]
fc4c15d823
2016-11-21 12:56:20 +01:00
Yves Senn
fc4c15d823 eager_autoload needs to be triggered for nested constants.
When `ActiveRecord::Associations.eager_load!` is called, it eager loads
the `Preloader` but does not trigger a `eager_load!` on the `Preloader`
itself. A eager loaded component is responsible to forward the
`eager_load!` call to nested constants that make use of `eager_autoload`
as well.

This will also resolve the occasional `NameError` that we've observed in
production:

```
NameError: uninitialized constant ActiveRecord::Associations::Preloader::BelongsTo
```
2016-11-21 12:41:35 +01:00
Kasper Timm Hansen
6d6249b1c1 ✂️ needless lines beneath private. 2016-11-20 17:58:36 +01:00
Kasper Timm Hansen
71117e1451 Merge pull request #27111 from maclover7/jm-xmlmini
Refactor ActiveSupport::XMLMini test suite
2016-11-20 17:57:16 +01:00
Jon Moss
8e3901b5e6 Move tests to a module, include in subclasses, style linting
This fixes an error where the test runner would try and run
XMLMiniEngineTest like a normal test class, except it's abstract. Now,
to circumvent this, we don't include any of the actual tests in
XMLMiniEngineTest; they are wrapped in a module that is included in
subclass when they inherit from XMLMiniEngineTest. Pretty neat, huh?
2016-11-20 10:46:16 -05:00
Jon Moss
0ab54f4a49 Create XMLMiniEngineTest; base class for all tests 2016-11-20 10:46:16 -05:00
Jon Moss
2bdc4ddc06 Code styling cleanup 2016-11-20 10:45:58 -05:00
Jon Moss
305e2922a4 Create CommonXMLMiniAdapterTest; common tests module
Created a new module (a la Action Cable subscription adapter's test
suite) to be included in all sub class test to ensure compatability and
reduce duplicated code.
2016-11-20 10:45:09 -05:00
Kasper Timm Hansen
5aea0952e7 Pass rails runner args onto file again.
When making the new command insfrastructure I had missed that
`bin/rails runner some_file.rb some args` would pass the extra
args onto the file in `ARGV`.

Now fixed by allowing the command to take extra args again, and
make sure to remove the file name from `ARGV`.
2016-11-20 16:02:39 +01:00
Kasper Timm Hansen
e6c808e354 Merge pull request #27118 from prathamesh-sonpatki/correct-prepared-statements-test
Fix prepared statements disabled test again
2016-11-20 14:32:28 +01:00
Prathamesh Sonpatki
8b77d8e387
Fix prepared statements disabled test again
- Due to `assert_nothing_raised` this test was not really testing
  anything.
- So updated it to assert that the query gives expected result.
- Also in general we can use `connection.unprepared_statement` for
  testing queries w/o prepared statements but it can't be used in this
  case. This test cases was added because when prepared_statements
  config is set to false, then DetermineIfPreparableVisitor module
  does not extended by Arel visitor resulting into an error. Ref: https://github.com/rails/rails/pull/22748.
- Because DetermineIfPreparableVisitor module does not get added to the
  visitor chain only if prepared_statements is false while **setting up
  connection**, not when `unprepared_statement` is used.
- I have also added an assertion for making sure that prepared_config
  is set to false from the start, so that nobody accidentally removes
  the connection setup using `arunit_without_prepared_statements` and
  replaces it with stubs or unprepared_statement.
2016-11-20 14:20:35 +05:30
Guillermo Iguaran
9008a60dc5 Merge pull request #27117 from kirs/activemodel-testing-implementation
Do not rely on Ruby implementation in AM test
2016-11-19 21:27:44 -05:00
Guillermo Iguaran
03fc9a4930 Use existing --skip-turbolinks option for conditionals instead of checking if turbolinks is present in gemfile list 2016-11-19 21:26:34 -05:00
Kir Shatrov
5abf662959 Do not rely on Ruby implementation in AM test
Now a few tests in ActiveModel rely on Ruby implementation and the fact
that in MRI `97.18` as a float is greater than `97.18` as a BigDecimal.

This is only relevant for MRI. On JRuby, comparing float to BigDecimal
would be conversion of them to the same type and they will be equal.

I'd like the ActiveModel test suite to be Ruby implementation-agnostic.
Here we test ActiveModel, not the Ruby internals.
This PR fixes a couple more JRuby tests.
2016-11-19 21:02:29 -05:00
Jon Moss
20db1dab77 Merge pull request #27116 from maclover7/jm-actionview-docs
Change html-scanner to rails-html-sanitizer
2016-11-19 20:32:30 -05:00
Jon Moss
4c3afea7df Change html-scanner to rails-html-sanitizer
[ci skip]
2016-11-19 20:31:25 -05:00
Jon Moss
c144a20c40 Merge pull request #27115 from rails/revert-27114-fix_typo
Revert "fix typo in `match` doc [ci skip]"
2016-11-19 20:19:34 -05:00
Jon Moss
05629d4aaa Revert "fix typo in match doc [ci skip]" 2016-11-19 20:19:22 -05:00
Guillermo Iguaran
4aeb73af1b Merge pull request #27114 from y-yagi/fix_typo
fix typo in `match` doc [ci skip]
2016-11-19 19:59:52 -05:00
yuuji.yaginuma
fa5436e017 fix typo in match doc [ci skip]
s/Constrains/Constraints
2016-11-20 09:49:08 +09:00
Kasper Timm Hansen
e7aeafc727 Merge pull request #27112 from kamipo/follow-up-27109
Fix typo s/with/without/
2016-11-19 23:00:19 +01:00
Ryuta Kamizono
8e1b28ad7f Fix typo s/with/without/
Follow up to #27109.
2016-11-20 05:47:30 +09:00
Eileen M. Uchitelle
64127cde8c Merge pull request #27106 from prathamesh-sonpatki/add-missing-test
Add missing test for singular resource output in rake routes
2016-11-19 15:41:09 -05:00
Kasper Timm Hansen
1cf995688d Merge pull request #27109 from prathamesh-sonpatki/fix-prepared-statements-test
Fix tests for prepared_statements: false and queries hitting `#select_all`
2016-11-19 18:02:04 +01:00
Prathamesh Sonpatki
7b6b52d6bc
Fix tests for prepared_statements: false and queries hitting #select_all
- The query needs to be executed for hitting `select_all` so made sure
  that query gets executed.
- Also instead of changing instance variable, just add new
  configuration for prepared_statements: false and use it for this
  test.
- This way we don't have to touch the internals of AR code and still
  disable prepared statements config for this test.
2016-11-19 21:52:52 +05:30
Jon Moss
3256dcd8b9 Install libxml-ruby gem so full XMLMini test suite can be run 2016-11-19 10:46:28 -05:00
Jon Moss
1d18b9b2fb Do not include ActiveSupport into test classes
Will help get rid of errors like the following:

```
  1) Error:
JDOMEngineTest#test_order=:
ArgumentError: wrong number of arguments (0 for 1)
    /Users/jon/code/rails/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb:106:in `test_order='
```
2016-11-19 10:30:57 -05:00
Eileen M. Uchitelle
4aacace550 Merge pull request #27103 from y-yagi/move_changelog_entry_to_appropriate_file
move CHANGELOG entry to the appropriate file [ci skip]
2016-11-19 09:03:15 -05:00
Prathamesh Sonpatki
b945c9ad62
Add missing test for singular resource output in rake routes
- 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
2016-11-19 16:24:28 +05:30
Matthew Draper
f9230a2d42 Merge pull request #27057 from kamipo/fix_race_condition
Fix the race condition caused by `with_new_connections_blocked`
2016-11-19 20:33:02 +10:30
yuuji.yaginuma
f5e738b604 move CHANGELOG entry to the appropriate file [ci skip]
Follow up to #27098
2016-11-19 16:18:21 +09:00
Rafael Mendonça França
ff2fe014d9
Merge pull request #27089 from erickueen/erickueen_fix_26606
Fix incorrect output from rails routes when using singular resources …
2016-11-18 17:38:35 -05:00
Rafael França
8106a177a4 Merge pull request #27092 from prathamesh-sonpatki/https-source-bundler
Use secure source for gems referencing "github" in the generated apps
2016-11-18 16:54:31 -05:00
Erick Reyna
c79848e1e7 Fix incorrect output from rails routes when using singular resources issue #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.
2016-11-18 15:12:13 -06:00
Rafael Mendonça França
60c333eb10
Merge pull request #27098 from sina-s/fix-unexpected-session-sharing
Fix unexpected session sharing
2016-11-18 15:07:33 -05:00
Tawan Sierek
064744bef6
Fix ActionDispatch::IntegrationTest#open_session
Reset a new session directly after its creation in
`ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean
state before making it available to the client's test code.

Issue #22742 reports unexpected behavior of integration tests that run multiple
sessions. For example an `ActionDispatch::Flash` instance is shared across
multiple sessions, though a client code will rightfully assume that each new
session has its own flash hash.

The following test failed due to this behavior:

    class Issue22742Test < ActionDispatch::IntegrationTest
      test 'issue #22742' do
        integration_session # initialize first session
        a = open_session
        b = open_session

        refute_same(a.integration_session, b.integration_session)
      end
    end

Instead of creating a new `ActionDispatch::Integration::Session` instance,
the same instance is shared across all newly opened test sessions. This is
due to the way how new test sessions are created in
`ActionDispatch::IntegrationTest#open_session`. The already existing
`ActionDispatch::IntegrationTest` instance is duplicated  with `Object#dup`,
This approach was introduced in commit 15c31c7639b. `Object#dup` copies the
instance variables, but not the objects they reference. Therefore this issue
only occurred when the current test instance had been tapped in such a way that
the instance variable `@integration_session` was initialized before creating the
new test session.

Close #22742

[Tawan Sierek + Sina Sadeghian]
2016-11-18 15:07:16 -05:00
Kasper Timm Hansen
8dbc1ca339 Merge pull request #27094 from y-yagi/remove_warnings_from_activejob_test_helper
remove Ruby warning from Active Job test helper methods
2016-11-18 11:15:56 +01:00
yuuji.yaginuma
5b825c55fe remove Ruby warning from Active Job test helper methods
This removes the following warnings.

```
/home/travis/build/rails/rails/activejob/lib/active_job/test_helper.rb:241: warning: shadowing outer local variable - job
/home/travis/build/rails/rails/activejob/lib/active_job/test_helper.rb:265: warning: shadowing outer local variable - job
```
2016-11-18 18:20:48 +09:00
Prathamesh Sonpatki
efcc361b32
Use secure source for gems referencing "github" in the generated apps
- New apps generated on master and latest bundler give warning about
  "github" source being insecure.
- Use the same solution used for Rails master in the generated app's
  Gemfile to fix this issue.
2016-11-18 12:24:48 +05:30
Ryuta Kamizono
700639e4f6 Fix the race condition caused by with_new_connections_blocked
`with_new_connections_blocked` was introduced at #14938.
But the method sometimes causes `@new_cons_enabled = false` then never
toggled to true.
2016-11-18 09:59:42 +09:00
Rafael França
796049ef3e Merge pull request #26551 from mgpnd/FixContentLength
Fixed CONTENT_LENGTH header in ActionController::TestRequest
2016-11-17 19:00:18 -05:00
Rafael França
c659cb8561 Merge pull request #26981 from kamipo/should_not_except_order_for_exists
Should except `:distinct` rather than `:order` for `exists?`
2016-11-17 18:27:25 -05:00
Rafael França
6e63b0aa13 Merge pull request #27090 from tomprats/update-preprocessor-documentation
Updated Sprockets Documentation
2016-11-17 18:22:56 -05:00
Rafael França
76c273868e Merge pull request #27070 from jonhyman/patch-raw-true
Removes 'raw: true' from MemCacheStore#read_multi
2016-11-17 18:18:34 -05:00
Tom Prats
dd66493d70 Updated Sprockets Documentation 2016-11-17 18:18:14 -05:00
Sean Griffin
7a3be90dce Refactor the handling of fallback exception handlers 2016-11-17 15:03:57 -05:00
Sean Griffin
4331ee8390 Merge pull request #27076 from y-yagi/fix_postgresql_array_encoding
use `force_encoding` instread of `encode!` to avoid `UndefinedConversionError`
2016-11-17 14:56:38 -05:00
Sean Griffin
07af54d43c Merge pull request #26980 from kamipo/respect_new_records_for_collection_proxy_distinct
Respect new records for `CollectionProxy#uniq`
2016-11-17 14:55:19 -05:00
Sean Griffin
f48bb1b4ad Call fallback exception handlers with the right exception
The issue presented in #26246 showed a deeper underlying problem. When
we fell back to the exception handler for an exceptions cause, we were
calling that handler with the outer raised exception. This breaks the
calling code's expectations, especially if the exception has methods on
it behond those from `StandardError`.
2016-11-17 14:50:41 -05:00
Vipul A M
8d015dff82 Remove mention of deprecated SafeERB gem from security docs for now, prior section already speaks about sanitization as a safety measure. [ci skip] (#27086)
Fixes #27085
2016-11-18 00:11:48 +05:30