Commit Graph

69804 Commits

Author SHA1 Message Date
bogdanvlviv
d2ccf0c6f7
Simplify configuring of ActionCable.server.config.logger for actioncable tests
See `git grep "= Logger.new(nil)"`
2018-08-23 12:36:19 +03:00
bogdanvlviv
1055d14127
Set the test adapter for the test environment by default in config/cable.yml 2018-08-23 12:33:02 +03:00
bogdanvlviv
0e42d3db59
Clarify api docs of ActionCable::SubscriptionAdapter::Test
Remove extra `:nodoc:` comment since private methods doesn't require that.
2018-08-23 12:30:16 +03:00
George Claghorn
dc001dbd58
Merge pull request #33666 from cbothner/fail-gracefully-from-activestorage-file-not-found
Fail more gracefully from ActiveStorage missing file exceptions
2018-08-22 22:56:10 -04:00
Nick Schwaderer
cdee52079c Include form_with in form_helpers rails guide (#33523)
* Include form_with in form_helpers rails guide

* Include form_tag and form_for footnote

* Id and class attributes are not wrapped anymore

* Include note that all form_with forms are remote:true by default

* Underline most common use case of form_with is with arguments

* Form_with no longer accepts multiple hashes in form helper calls

* Review final sections

* Revert extra documentation

* Remove unnecessary link
2018-08-22 17:42:28 -07:00
Rafael França
022a47ce15
Merge pull request #33698 from bogdanvlviv/follow-up-33693
Remove extra execution of `uniq!` on action_methods
2018-08-22 17:06:13 -05:00
Rafael França
c97faea18c
Merge pull request #33695 from peterzhu2118/master
Update ParameterFilter to yield original parameters
2018-08-22 16:08:50 -05:00
bogdanvlviv
4800a613c0
Remove extra execution of uniq! on action_methods
Execution of `to_set` below should remove duplicated elements.

Follow up #33693
2018-08-22 23:48:00 +03:00
Richard Schneeman
17978719e4
Merge pull request #33693 from schneems/schneems/action_methods
Two fewer array allocations on action_methods
2018-08-22 13:16:08 -07:00
Rafael França
9963c2a008
Merge pull request #33697 from bogdanvlviv/rails-command-help-show-description
Fix `rails initializers --help` and `rails dev:cache --help`
2018-08-22 15:05:56 -05:00
Peter Zhu
ce6166f307 Update ParameterFilter to yield original parameters 2018-08-22 15:54:26 -04:00
bogdanvlviv
7bd29b506c
Fix rails initializers --help and rails dev:cache --help
- `rails initializers --help` should show description set by `desc`
  See railties/lib/rails/command/base.rb:27

- Fix `rails dev:cache --help`

 ```
 Traceback (most recent call last):
         10: from bin/rails:4:in `<main>'
          9: from bin/rails:4:in `require'
          8: from /work/rails/railties/lib/rails/commands.rb:18:in `<top (required)>'
          7: from /work/rails/railties/lib/rails/command.rb:46:in `invoke'
          6: from /work/rails/railties/lib/rails/command/base.rb:65:in `perform'
          5: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
          4: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
          3: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
          2: from /work/rails/railties/lib/rails/command/base.rb:150:in `help'
          1: from /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:170:in `command_help'
 /home/vagrant/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/base.rb:497:in `handle_no_command_error': Could not find command "dev". (Thor::UndefinedCommandError)
  ```

Context https://github.com/rails/rails/pull/33694#issuecomment-415127304

Would be great to set a description to other commands.
2018-08-22 22:36:25 +03:00
Rafael França
541b78a71f
Merge pull request #33685 from krusty3002/master
Added explanation about new_framework_defaults.rb file [ci skip]
2018-08-22 13:05:51 -05:00
Rafael França
4e9ff46cea
Merge pull request #33694 from bogdanvlviv/follow-up-33631
Remove `rake initializers` from rake tasks list
2018-08-22 13:03:49 -05:00
bogdanvlviv
63b9bf7d3d
Remove rake initializers from rake tasks list
Context https://github.com/rails/rails/pull/33631#discussion_r210732565
2018-08-22 20:49:37 +03:00
Kasper Timm Hansen
9136bb77a7
Merge pull request #33162 from utilum/stop_using_mocha
Stop using Mocha
2018-08-22 18:20:25 +02:00
schneems
4efb319141 Two fewer array allocations on action_methods
Instead of creating new arrays for `uniq` and `map` we can instead modify the array in place.
2018-08-22 11:17:50 -05:00
Ryuta Kamizono
b729494454 Partly revert unused accessor
This was introduced at 24f6bf0d96b58f2b2ef6a886c93d35cf8ce4f293.
2018-08-23 00:40:32 +09:00
Matthew Draper
24f6bf0d96
Merge pull request #33691 from tgxworld/add_config_to_disable_advisory_locks
Add database configuration to disable advisory locks.
2018-08-23 01:04:14 +09:30
Matthew Draper
047a893da7 Merge pull request #33547 from Ana06/patch-1
Use public_send in value_for_collection
2018-08-23 00:08:35 +09:30
Eileen M. Uchitelle
9eee4c1ed9
Merge pull request #33659 from palkan/feature/action-cable-testing
[WIP] Action cable testing
2018-08-22 10:27:20 -04:00
Guo Xiang Tan
20bb397e00 Add database configuration to disable advisory locks.
https://github.com/rails/rails/issues/31190
2018-08-22 22:06:08 +08:00
utilum
96ac7e4cde Remove duplicate test
This patch corrects a duplicate method name introduced in #33635.

Also fixes typo in method names.
2018-08-22 01:41:09 -07:00
Claas Zurawski
d587cf2325 Fixed file name [ci skip] 2018-08-22 10:15:49 +02:00
Claas Zurawski
4858310e36 Added explanation about new_framework_defaults.rb file [ci skip] 2018-08-22 10:04:28 +02:00
Rafael França
1994e89021
Merge pull request #33682 from mroutis/brewfile-add-imagemagick
[ci skip] Add ImageMagick to Brewfile
2018-08-21 23:11:28 -05:00
Mr. Outis
feb348d538 [ci skip] Add ImageMagick to Brewfile
In order to run ActiveStorage's tests successfully, you need imagemagick
2018-08-21 23:01:12 -05:00
yuuji.yaginuma
f9dbc69c64 Show the ENV value correctly in the doc of combined_fragment_cache_key [ci skip]
It seems to need an escape for the showing `ENV`.
https://api.rubyonrails.org/classes/AbstractController/Caching/Fragments.html#method-i-combined_fragment_cache_key
2018-08-22 12:33:03 +09:00
George Claghorn
14ecf58b54 Add missing newline [ci skip] 2018-08-21 22:35:09 -04:00
George Claghorn
c658c134b7
Merge pull request #33680 from mroutis/update-guides-activestorage-dependencies
[ci skip] Add ImageMagick to ActiveStorage dependencies
2018-08-21 21:51:58 -04:00
Mr. Outis
63f63fe67b [ci skip] Add ImageMagick to ActiveStorage dependencies
In order to run ActiveStorage's tests successfully, you need
imagemagick.
2018-08-21 20:48:04 -05:00
Rafael França
c03dde6117
Merge pull request #29838 from fschwahn/patch-1
Add usage of procs without arguments to callbacks guide
2018-08-21 14:53:03 -05:00
Cameron Bothner
22efb2ec49 Respond with 404 in ActiveStorage::DiskController#show when file missing
`ActiveStorage::DiskController#show` generates a 404 Not Found response when
the requested file is missing from the disk service. It previously raised
`Errno::ENOENT`.
2018-08-21 15:35:58 -04:00
Cameron Bothner
5cd2d07bdc Translate service-specific missing object exceptions into a generic one
`ActiveStorage::Blob#download` and `ActiveStorage::Blob#open` raise
`ActiveStorage::FileNotFoundError` when the corresponding file is missing
from the storage service. Services translate service-specific missing
object exceptions (e.g. `Google::Cloud::NotFoundError` for the GCS service
and `Errno::ENOENT` for the disk service) into
`ActiveStorage::FileNotFoundError`.
2018-08-21 15:31:14 -04:00
Richard Schneeman
27934451b2
Merge pull request #33660 from y-yagi/follow_up_32121
Make `rake routes` deprecate before deleting
2018-08-21 06:57:04 -07:00
Jeremy Daer
2b594b061f
Merge pull request #33635 from bogdanvlviv/improve-active_job-test_helpers
Improve Active Job test helpers
2018-08-20 13:50:28 -07:00
Ryuta Kamizono
96cd16bdee Fix merging relation that order including ?
The `Relation::Merger` has a problem that order values would be merged
as nested array.

That was caused an issue #33664 since if array value is passed to
`order` and first element in the array includes `?`, the array is
regarded as a prepared statement and bind variables.

https://api.rubyonrails.org/classes/ActiveRecord/Sanitization/ClassMethods.html#method-i-sanitize_sql_for_order

Just merging that as splat args like other values would fix the issue.

Fixes #33664.
2018-08-21 00:01:38 +09:00
Ryuta Kamizono
ffca883908
Merge pull request #33662 from yskkin/multi_word_route
Fix `rails routes -c` for controller name consists of multiple word.
2018-08-20 20:41:19 +09:00
Ryuta Kamizono
3e3a0d1cc3
Merge pull request #33652 from tgxworld/improve_tests_pool_config
Improve tests for ActiveRecord::ConnectionAdapters::ConnectionPool co…
2018-08-20 19:20:20 +09:00
Yoshiyuki Kinjo
e2d0b3b375 Fix rails routes -c for controller name consists of multiple word. 2018-08-20 19:17:40 +09:00
bogdanvlviv
b8576425ee
DRY in assert_enqueued_jobs 2018-08-20 13:05:29 +03:00
bogdanvlviv
b7beb5d4e5
Fix formatting of ActiveJob::TestHelper api docs 2018-08-20 13:05:29 +03:00
bogdanvlviv
2ec60fb818
Allow assert_performed_with to be called without a block.
Example:
```
def test_assert_performed_with
  MyJob.perform_later(1,2,3)

  perform_enqueued_jobs

  assert_performed_with(job: MyJob, args: [1,2,3], queue: 'high')
end
```

Follow up #33626.
2018-08-20 13:05:29 +03:00
bogdanvlviv
11634e8ef8
Fix assert_performed_jobs and assert_no_performed_jobs
Execution of `assert_performed_jobs`, and `assert_no_performed_jobs`
without a block should respect passed `:except`, `:only`, and `:queue` options.
2018-08-20 13:05:29 +03:00
bogdanvlviv
2bf8b4eb0e
Add changelog entry about adding :queue option to job assertions and helpers
Note that it removes changelog entry of #33265 since the entry in this commits
includes that too.
2018-08-20 13:05:29 +03:00
bogdanvlviv
de4420da44
Allow :queue option to assert_no_performed_jobs.
If the `:queue` option is specified, then only the job(s) enqueued to a specific
queue will not be performed.

Example:
```
def test_assert_no_performed_jobs_with_queue_option
  assert_no_performed_jobs queue: :some_queue do
    HelloJob.set(queue: :other_queue).perform_later("jeremy")
  end
end
```
2018-08-20 13:05:29 +03:00
bogdanvlviv
d50fb21e4d
Allow :queue option to assert_performed_jobs.
If the `:queue` option is specified, then only the job(s) enqueued to a specific
queue will be performed.

Example:
```
def test_assert_performed_jobs_with_queue_option
  assert_performed_jobs 1, queue: :some_queue do
    HelloJob.set(queue: :some_queue).perform_later("jeremy")
    HelloJob.set(queue: :other_queue).perform_later("bogdan")
  end
end
```
2018-08-20 13:05:29 +03:00
bogdanvlviv
e0cf042fa2
Fix perform_enqueued_jobs
Set
````
queue_adapter.perform_enqueued_jobs = true
queue_adapter.perform_enqueued_at_jobs = true
queue_adapter.filter = only
queue_adapter.reject = except
queue_adapter.queue = queue
```
if block given.
Execution of `flush_enqueued_jobs` doesn't require that.
2018-08-20 13:05:22 +03:00
Guo Xiang Tan
ce048a7a73 Speed up slow ConnectionPool test case. 2018-08-20 17:49:05 +08:00
Fabian Schwahn
ec6089995d Improve documentation of Procs as :if / :unless options for callbacks 2018-08-20 11:44:31 +02:00