Commit Graph

65665 Commits

Author SHA1 Message Date
Ryuta Kamizono
38b2904f2c
Merge pull request #31411 from eugeneius/time_helpers_redefine_method
Prevent race condition when resetting time stubs
2017-12-12 16:23:31 +09:00
Eugene Kenny
6122d2bfdf Prevent race condition when resetting time stubs
If the current thread is preempted after the stub has been removed but
before the original method has been restored, then the other thread will
get a `NoMethodError` when it tries to call the method.

Using `silence_redefinition_of_method` instead of `undef_method` ensures
that either the stub or the original method is always in place.
2017-12-12 06:31:45 +00:00
Ryuta Kamizono
84194ecd62
Merge pull request #31410 from swrobel/patch-3
Fix secrets command deprecation message
2017-12-12 15:06:08 +09:00
Ryuta Kamizono
c5462d1f27
Merge pull request #31402 from yhirano55/update_routing_guide_for_direct_method
[ci skip] Update routing guide for Direct & resolved routes
2017-12-12 14:56:21 +09:00
Stefan Wrobel
76e545546c
Fix secrets command deprecation message 2017-12-11 21:39:41 -08:00
Yoshiyuki Hirano
3dc774f371 [ci skip] Update routing guide for Direct
* Added the direct method to routing guide.
2017-12-12 14:07:58 +09:00
George Claghorn
6129d1f937 Fix optimizing GIF variants using mogrify's -layers option 2017-12-11 18:32:14 -05:00
George Claghorn
931fe37aa7 Revert "Invoke mogrify once when transforming an image"
This reverts commit a80f81af055f02bf4625c90470aa90441cf6fc24.
2017-12-11 18:30:21 -05:00
Rafael França
b9de7ea8d1
Merge pull request #31407 from Edouard-chin/remove-create-fixtures-helper
`create_fixtures` doesn't work since at least a94220b
2017-12-11 17:55:14 -05:00
Edouard CHIN
e6ef1a7673 create_fixtures doesn't work since at least a94220b66c9e4890007f66b092b25f8a64a19d31:
- The namespacing should be `ActiveRecord::FixtureSet`
- I might be missing something but I'm not sure why `create_fixtures` is useful for nowaday (unless for testing rails internal /shrug) and since it's been that long it wasn't working I think it should be fine to just fire it
2017-12-11 17:22:05 -05:00
George Claghorn
02e058a2f2
Merge pull request #31399 from yhirano55/return_nil_if_raise_http_error
Return `nil` instead of `false` if raise `Azure::Core::Http::HTTPError`
2017-12-11 14:32:20 -05:00
George Claghorn
9965b98dc0
Merge pull request #31401 from yhirano55/update_instrumentation_guide_for_active_storage_service
[ci skip] Update instrumentation guide for ActiveStorage
2017-12-11 14:20:58 -05:00
Yoshiyuki Hirano
19e9e1492e [ci skip] Update instrumentation guide for ActiveStorage
* Added `service_delete_prefixed.active_storage`.
2017-12-12 04:17:14 +09:00
George Claghorn
a80f81af05 Invoke mogrify once when transforming an image
Execute a single mogrify command with multiple options rather than one command per option. Permit the use of all mogrify options, not just the ones that fall through to MiniMagick::Image#method_missing.
2017-12-11 13:28:05 -05:00
Yoshiyuki Hirano
4c590e9d2e Return nil instead of false if raise Azure::Core::Http::HTTPError
* If it raise error `Azure::Core::Http::HTTPError`, return `nil` instead of `false` in
  `ActiveStorage::Service::AzureStorageService#delete`.

* Other services behave as same as this.
2017-12-12 02:57:38 +09:00
Eileen M. Uchitelle
4edce566ad
Merge pull request #30361 from mfo/master
StreamingTemplateRenderer fails to forward I18n.locale in layouts
2017-12-11 08:08:03 -05:00
Javan Makhmali
a41fa1fae0
Merge pull request #31389 from yhirano55/webpack_config_in_active_storage
`webpack` is assigned but never used in webpack.config.js
2017-12-11 06:49:03 -05:00
Eileen M. Uchitelle
9b2180c7de
Merge pull request #31390 from lonre/patch-1
Remove whitespace
2017-12-10 14:22:46 -05:00
Lonre Wang
a6031e40ba
Update validates.rb 2017-12-10 22:17:48 +07:00
Yoshiyuki Hirano
fc8947012f webpack is assigned but never used in webpack.config.js
* Removed webpack const, so it is assigned but never used in webpack.config.js.
2017-12-11 00:01:16 +09:00
yuuji.yaginuma
cf0fcbe7f6 Reset schema cache after test
Currently, `test_copy_table_with_composite_primary_keys` test fails
depending on execution order. The reproduction step is as follows.

```
$ ARCONN=sqlite3_mem bin/test -w -n "/^(?:CalculationsTest#(?:test_#skip_query_cache\\!_for_a_simple_calculation)|PrimaryKeyAnyTypeTest#(?:test_any_type_primary_key)|ActiveRecord::ConnectionAdapters::SQLite3AdapterTest#(?:test_copy_table_with_composite_primary_keys))$/" --seed 41545
```

The column info is cached by `PrimaryKeyAnyTypeTest#test_any_type_primary_key`,
and the test seems to have failed due to the influence.
So clear cache after testing so as not to affect other tests.

Related: https://travis-ci.org/rails/rails/jobs/313730163#L1788
2017-12-10 13:00:12 +09:00
Guillermo Iguaran
1b24fb213b
Merge pull request #31384 from rails/dont-override-server
Change the system tests to set Puma as default server only when the user haven't specified manually another server.
2017-12-09 18:34:34 -05:00
Guillermo Iguaran
f1b4cd1ad4 Change the system tests to set Puma as default server only when the user haven't specified manually another server. 2017-12-09 16:46:31 -05:00
Guillermo Iguaran
5d7b70f433 Add secure X-Download-Options and X-Permitted-Cross-Domain-Policies to default headers set. 2017-12-09 15:41:55 -05:00
Ryuta Kamizono
55d4cf2a9c
Merge pull request #31379 from bogdanvlviv/ci-against-jruby_9_1_15
CI against JRuby 9.1.15.0
2017-12-09 15:33:53 +09:00
Claudio B
a521e03c9c
Merge pull request #31354 from maciej-ka/docs-link_to-nil-name-example
docs: add example for a nil name in link_to
2017-12-08 20:05:00 -08:00
Aaron Patterson
bc2e08034d
Merge pull request #31355 from rails/fix-rails-env-with-ruby
Fix Rails environment when running tests with Ruby
2017-12-08 16:54:57 -06:00
Aaron Patterson
a50b8ea350
Set the Rails environment from an environment variable
Option parsing happens too late to have any impact on the Rails
environment.  Rails accesses the environment name and memoizes it too
early in the boot process for a commandline option to have any impact on
the database connection, so we'll change this test to set the
environment from an environment variable (and ensure it still works when
running tests with `ruby`)
2017-12-08 14:50:27 -08:00
Aaron Patterson
cd0283ef29
Revert "remove unnecessary RAILS_ENV setting"
This reverts commit 9a80f52541ed2c93ebef02909ecab3aaf9127150.
2017-12-08 13:27:30 -08:00
bogdanvlviv
b47eeadb36
CI against JRuby 9.1.15.0
JRuby 9.1.15.0 has been released:
http://jruby.org/2017/12/07/jruby-9-1-15-0.html
2017-12-08 23:27:18 +02:00
Aaron Patterson
a58543dbb1
Add failing test for wrong database connection
When tests are run with just `ruby`, the RAILS_ENV is set to
`development` too early, and we connect to the development database
rather than the test database.
2017-12-08 13:23:31 -08:00
George Claghorn
da8e0ba03c Swap raw video width and height if angle is 90 or 270 degrees 2017-12-08 13:15:04 -05:00
Ryuta Kamizono
131cc6eab6 SQLite: Fix copy_table with composite primary keys
`connection.primary_key` also return composite primary keys, so
`from_primary_key_column` may not be found even if `from_primary_key` is
presented.

```
% ARCONN=sqlite3 be ruby -w -Itest
test/cases/adapters/sqlite3/sqlite3_adapter_test.rb -n
test_copy_table_with_composite_primary_keys
Using sqlite3
Run options: -n test_copy_table_with_composite_primary_keys --seed 19041

# Running:

E

Error:
ActiveRecord::ConnectionAdapters::SQLite3AdapterTest#test_copy_table_with_composite_primary_keys:
NoMethodError: undefined method `type' for nil:NilClass
    /path/to/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:411:in
    `block in copy_table'
```

This change fixes `copy_table` to do not lose composite primary keys.
2017-12-08 11:05:33 +09:00
Sean Griffin
e88e6cea21
Merge pull request #30780 from JackMc/fix-chrome-referrer-invalidauthenticitytoken
Fix issue #30658 by checking explicitly for 'null' referrer
2017-12-07 14:19:39 -07:00
George Claghorn
e8286ee272 Fix customizing Content-Type via GCS service URLs 2017-12-07 15:16:24 -05:00
Eileen M. Uchitelle
e8c3b58cb6
Merge pull request #31365 from bogdanvlviv/add-headless_firefox-driver-to-system_tests
Add headless firefox driver to System Tests
2017-12-07 14:44:05 -05:00
Ryuta Kamizono
6a8ce7416d Fix scope_for_create to do not lose polymorphic associations
This regression was caused at 213796fb due to polymorphic predicates are
combined by `Arel::Nodes::And`. But I'd like to keep that combined
because it would help inverting polymorphic predicates correctly
(e9ba12f7), and we can collect equality nodes regardless of combined by
`Arel::Nodes::And` (`a AND (b AND c) AND d` == `a AND b AND c AND d`).
This change fixes the regression to collect equality nodes in
`Arel::Nodes::And` as well.

Fixes #31338.
2017-12-08 03:42:04 +09:00
bogdanvlviv
82b974813b
Add headless firefox driver to System Tests 2017-12-07 20:20:54 +02:00
Eileen M. Uchitelle
bbacd60048
Merge pull request #31327 from aellispierce/custom-id-change-table-sqlite
Fix sqlite migrations with custom primary keys
2017-12-07 07:58:21 -05:00
Andrew White
e2c1d5e1d7
Merge pull request #31358 from yhirano55/made_example_codes_inherit_application_record
[ci skip] Make `Todo` classes inherit `ApplicationRecord`
2017-12-07 11:20:16 +00:00
Yoshiyuki Hirano
2fa2903767 [ci skip] Make Todo classes inherit ApplicationRecord
Example codes that use `has_many` or `before_create` in `Module::Concerning` look like active record models.
So I've made them inherit `ApplicationRecord`.
2017-12-07 14:53:53 +09:00
Aaron Patterson
da225c0db6
Fix Rails environment when running tests with Ruby
I frequently run tests with `ruby`, not with a runner like `rake` or
`rails`.  When running the test with just `ruby` the `RAILS_ENV`
environment variable did not get set to "test", and this would cause the
tests to fail (and even mutate the development database!)

This commit adds integration tests for running tests with just `ruby`
and ensures the environment gets defaulted to "test".  I also added a
test to ensure that passing an environment to `-e` actually works (and
fixed that case too).

An interesting / annoying thing is that Minitest picks up it's plugins
by asking RubyGems for a list of files:

  ca6a71ca90/lib/minitest.rb (L92-L100)

This means that RubyGems needs to somehow know about the file before it
can return it to Minitest.  Since we are not packaging Rails as a Gem
before running the integration tests on it (duh, why would you do
that?), RubyGems doesn't know about the file, so it can't tell Minitest,
so Minitest doesn't automatically require it.  This means I had to
manually require and insert the plugin in our integration test.  I've
left comments about that in the test as well.

Ugh.
2017-12-06 20:40:04 -08:00
maciej-ka
46a4ac8a36 docs: add example for a nil name in link_to 2017-12-07 01:43:43 +01:00
Yuji Yaginuma
0ba5615e40
Merge pull request #31350 from ptolts/correct_test_spelling
Correct routing test spelling mistake.
2017-12-07 07:51:43 +09:00
Philip Tolton
faf169eedd Correct routing test spelling mistake. 2017-12-06 16:01:00 -05:00
Ashley Ellis Pierce
5ac4f4d256 Fix sqlite migrations with custom primary keys
Previously, if a record was created with a custom primary key, that
table could not be migrated using sqlite. While attempting to copy the
table, the type of the primary key was ignored.

Once that was corrected, copying the indexes would fail because custom
primary keys are autoindexed by sqlite by default.

To correct that, this skips copying the index if the index name begins
with "sqlite_". This is a reserved word that indicates that the
index is an internal schema object. SQLite prohibits applications from
creating objects whose names begin with "sqlite_", so this string should
be safe to use as a check.
ref https://www.sqlite.org/fileformat2.html#intschema
2017-12-06 15:16:12 -05:00
Ryuta Kamizono
19d2fab6ff
Merge pull request #31344 from kamipo/use_string_instead_of_text
Use `:string` instead of `:text` for `JsonAttributeTest`
2017-12-07 04:32:05 +09:00
Yasuo Honda
b34838cbe2 Address ActiveRecord::NotNullViolation: OCIError: ORA-01400 for Oracle database which requires primary key value mentioned in insert statement explicitly. 2017-12-07 04:01:21 +09:00
Rafael França
5d337fe386
Merge pull request #27790 from domcleal/ac-params-each-yields
Yield array from AC::Parameters#each for block with one arg
2017-12-06 11:01:44 -05:00
Dominic Cleal
d7a121a0d6
Yield array from AC::Parameters#each for block with one arg
Matches Hash#each behaviour as used in Rails 4.
2017-12-06 14:50:35 +00:00