aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
Commit message (Collapse)AuthorAgeFilesLines
* Enable Start/EndWith and RegexpMatch copsBart de Water2018-07-281-1/+1
| | | | | In cases where the MatchData object is not used, this provides a speed-up: https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
* Remove thirdparty FIXMEAlberto Almagro2018-07-251-2/+1
| | | | | | This FIXME belongs to a code example that was imported from the internet. As we aren't going to do anything about it, I prefer to remove it so it stops from appearing on searches.
* Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the futureRyuta Kamizono2018-07-121-1/+0
| | | | | | | We sometimes ask "✂️ extra blank lines" to a contributor in reviews like https://github.com/rails/rails/pull/33337#discussion_r201509738. It is preferable to deal automatically without depending on manpower.
* Better compatibility with SPEC.Samuel Williams2018-07-041-2/+4
| | | | | | If `env` is duped or otherwise not the same as the original `env` that was generated at the top of rack middleware, it is impossible for the server hijack proc to update the right `env` instance. Therefore, capturing the return value is more reliable. This is the recommendation of the rack SPEC.
* Remove redundant accessorsutilum2018-06-111-2/+0
| | | | introduced in a0ea528b61.
* Merge pull request #33102 from bogdanvlviv/refactor-actioncable-testsRafael França2018-06-0818-45/+12
|\ | | | | Refactor actioncable's tests
| * Include `ActiveSupport::Testing::MethodCallAssertions` to ↵bogdanvlviv2018-06-0813-36/+3
| | | | | | | | | | | | | | | | | | `ActionCable::TestCase` Remove all `include ActiveSupport::Testing::MethodCallAssertions` in actioncable's tests since we can do it only in `ActionCable::TestCase` in order to prevent code duplication. We use the same approach for other modules of Rails.
| * Inherit all actioncable's test classes from `ActionCable::TestCase`bogdanvlviv2018-06-089-9/+9
| | | | | | | | | | | | We have defined `ActionCable::TestCase` in `actioncable/test/test_helper.rb` that we can use in order to prevent code duplication and build common interface for actioncable's test.
* | Merge pull request #27577 from maclover7/jm-fix-27547Rafael Mendonça França2018-06-082-8/+47
|\ \ | |/ |/| | | Action Cable owns database connection, not Active Record
| * Action Cable owns database connection, not Active RecordJon Moss2017-03-252-8/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the database connection used in Action Cable's PostgreSQL adapter was "owned" by `ActiveRecord::Base.connection_pool`. This meant that if, for example, `#clear_reloadable_connections!` was called on the pool, Active Record would "steal" the database connection from Action Cable, and would cause all sorts of issues. This became evident during file reloads; despite Action Cable trying its hardest to return its borrowed database connection to Active Record via `@pubsub.shutdown`, Active Record calls `#clear_reloadable_connections!` on the connection pool, and due to the order of callbacks, Active Record's callback was being executed first. This meant that if you tried to rerender a view after a file was reloaded, you would have to wait through Active Record's timeout and such. Now, Action Cable takes direct ownership of the database connection it uses. It removes the connection from the pool to avoid the situation described above. Action Cable also makes sure to call `#disconnect!` on the connection when appropriate, to match the previous behavior of Active Record. [ Jon Moss & Matthew Draper]
* | Remove mocha from ActionCable testsutilum2018-05-311-1/+0
| | | | | | | | Q.E.D.
* | Use Ruby instead of mochautilum2018-05-313-6/+19
| |
* | Use minitest/mock instead of mochautilum2018-05-318-45/+101
| |
* | Fix actionable test's assertionbogdanvlviv2018-05-281-1/+1
| | | | | | | | | | Pull Request #32727 changed "mocha expects" in favor of `MethodCallAssertions`. This commit fixes assertion that became less strict after the PR.
* | remove unnecessary mocking in ActionCable testsutilum2018-05-225-39/+24
| |
* | assert_called_withutilum2018-04-261-4/+5
| |
* | assert_calledutilum2018-04-268-38/+71
| |
* | assert_not_calledutilum2018-04-262-4/+12
| |
* | Strip duplicated suffixes more strictlyRyuta Kamizono2018-04-221-1/+1
| | | | | | | | In the previous code incorrectly removes intermediate words.
* | Replace `assert !` with `assert_not`Daniel Colson2018-04-191-1/+1
| | | | | | | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* | 2.6 warning: passing splat keyword arguments as a single Hashutilum2018-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Ruby 2.6.0 warns about this. ``` ruby -v ruby 2.6.0dev (2018-04-04 trunk 63085) [x86_64-linux] ``` Before, see: https://travis-ci.org/rails/rails/jobs/365740163#L1262-L1264 https://travis-ci.org/rails/rails/jobs/365944863#L2121-L2174
* | Make Mocha setup explcitly Minitest-specificJames Mead2018-04-071-1/+1
| | | | | | | | | | This has been possible since Mocha v1.0 and makes it clear that we want Mocha to integrate with Minitest, not Test::Unit.
* | Class methods in the `class_methods` blocks are wrongly appeared in the docRyuta Kamizono2018-04-044-4/+4
| | | | | | | | | | | | | | It is wrongly appeared as instance public methods in the doc. http://api.rubyonrails.org/v5.1.6/classes/ActionCable/Channel/Callbacks.html http://api.rubyonrails.org/v5.1.6/classes/ActiveRecord/Timestamp.html
* | Remove changelog header for unreleased versionRafael Mendonça França2018-03-131-2/+0
| | | | | | | | | | | | We only add the header when releasing to avoid some conflicts. [ci skip]
* | Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-172-1/+6
| | | | | | | | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* | Clean up and consolidate .gitignoresbogdanvlviv2018-02-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Global ignores at toplevel .gitignore * Component-specific ignores in each toplevel directory * Remove `actionview/test/tmp/.keep` for JRuby ``` rm actionview/test/tmp/ -fr cd actionview/ bundle exec jruby -Itest test/template/digestor_test.rb ``` Related to #11743, #30392. Closes #29978.
* | Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-174-16/+4
| |
* | Remove support to Ruby 2.2Rafael Mendonça França2018-02-161-1/+1
| | | | | | | | Rails 6 will only support Ruby >= 2.3.
* | Start Rails 6.0 development!!!Rafael Mendonça França2018-01-303-36/+5
| | | | | | | | :tada::tada::tada:
* | Use assert_empty and assert_not_emptyDaniel Colson2018-01-251-3/+3
| |
* | Use assert_predicate and assert_not_predicateDaniel Colson2018-01-256-13/+13
| |
* | Change refute to assert_notDaniel Colson2018-01-251-1/+1
| |
* | Merge pull request #31732 from ↵Matthew Draper2018-01-191-1/+1
|\ \ | | | | | | | | | | | | koic/enable_autocorrect_for_lint_end_alignment_cop Enable autocorrect for `Lint/EndAlignment` cop
| * | Enable autocorrect for `Lint/EndAlignment` copKoichi ITO2018-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary This PR changes .rubocop.yml. Regarding the code using `if ... else ... end`, I think the coding style that Rails expects is as follows. ```ruby var = if cond a else b end ``` However, the current .rubocop.yml setting does not offense for the following code. ```ruby var = if cond a else b end ``` I think that the above code expects offense to be warned. Moreover, the layout by autocorrect is unnatural. ```ruby var = if cond a else b end ``` This PR adds a setting to .rubocop.yml to make an offense warning and autocorrect as expected by the coding style. And this change also fixes `case ... when ... end` together. Also this PR itself is an example that arranges the layout using `rubocop -a`. ### Other Information Autocorrect of `Lint/EndAlignment` cop is `false` by default. https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443 This PR changes this value to `true`. Also this PR has changed it together as it is necessary to enable `Layout/ElseAlignment` cop to make this behavior.
* | | Testing actioncable against websocket-driver 0.7.0 (#30711)Jared Beck2018-01-181-1/+1
|/ / | | | | | | * Depend on websocket-driver >= 0.6.1
* | PostgreSQL: Allow pg-1.0 gem to be used with ActiveRecordLars Kanis2018-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | pg-1.0.0 is just released and most Gemfiles don't restrict it's version. But the version is checked when connecting to the database, which leads to the following error: Gem::LoadError: can't activate pg (~> 0.18), already activated pg-1.0.0 See also this pg issue: https://bitbucket.org/ged/ruby-pg/issues/270/pg-100-x64-mingw32-rails-server-not-start Preparation for pg-1.0 was done in commit f28a331023fab, but the pg version constraint was not yet relaxed.
* | Bump license years for 2018Yoshiyuki Hirano2017-12-312-2/+2
| |
* | Preparing for 5.2.0.beta2 releaseRafael Mendonça França2017-11-283-2/+7
| |
* | Fix typos and add a few suggestionsFatos Morina2017-11-281-1/+1
| |
* | Preparing for 5.2.0.beta1 releaseRafael Mendonça França2017-11-273-2/+4
| |
* | Fix unstable test test_delegate_socket_errors_to_on_error_handlerFumiaki MATSUSHIMA2017-11-231-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I often face the following error when running test/connection/client_socket_test.rb: ``` $ bin/test test/connection/client_socket_test.rb:38 Run options: --seed 44035 # Running: F Failure: ActionCable::Connection::ClientSocketTest#test_delegate_socket_errors_to_on_error_handler [/app/actioncable/test/connection/client_socket_test.rb:47]: --- expected +++ actual @@ -1 +1 @@ -["foo"] +["Broken pipe", "Broken pipe", "Broken pipe", "foo"] ``` It can be reproduced easily by applying the following patch: ``` diff --git a/actioncable/test/connection/client_socket_test.rb b/actioncable/test/connection/client_socket_test.rb index 2051216010..6bb9f13ea7 100644 --- a/actioncable/test/connection/client_socket_test.rb +++ b/actioncable/test/connection/client_socket_test.rb @@ -34,7 +34,8 @@ def on_error(message) @server.config.allowed_request_origins = %w( http://rubyonrails.com ) end - test "delegate socket errors to on_error handler" do + 1000.times do |i| + test "delegate socket errors to on_error handler #{i}" do run_in_eventmachine do connection = open_connection @@ -47,6 +48,7 @@ def on_error(message) assert_equal %w[ foo ], connection.errors end end + end test "closes hijacked i/o socket at shutdown" do run_in_eventmachine do ``` The cause is writing io from different thread at the same time. `connection.process` sends handshake message from [StreamEventLoop's thread][] whereas `connection.handle_open` sends welcome message from current thread. [StreamEventLoop's thread]: https://github.com/rails/rails/blob/067fc779c4560fff4812614a2f78f9248f3e55f8/actioncable/lib/action_cable/connection/stream_event_loop.rb#L75
* | Use .tt extension to all the template filesRafael Mendonça França2017-11-136-0/+0
| | | | | | | | | | | | | | | | Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
* | Action Cable: run Redis tests against a default config without a passwordJeremy Daer2017-11-131-2/+21
| | | | | | | | | | | | | | | | Simplify our dev testing and CI story since we're also testing against Redis for the Active Support cache store. Directly test whether db, host, password, etc are passed through as config instead of spinning up a Redis server with a password set on it.
* | Enable `Style/RedundantReturn` rubocop rule, and fixed a couple moreRyuta Kamizono2017-11-011-1/+1
| | | | | | | | Follow up of #31004.
* | Remove CHANGELOG entry that was backported to Rails 5.1.3. [ci skip] (#30986)प्रथमेश Sonpatki2017-10-251-7/+0
| | | | | | - Backport commit: https://github.com/rails/rails/commit/7122a2cdc3634e170129f8b6cabd1e8fbed13c3d
* | Removed deprected evented redis adapterRafael Mendonça França2017-10-234-151/+5
| |
* | [Action Cable] require_relative => requireAkira Matsuda2017-10-213-3/+3
| | | | | | | | This basically reverts f851e1f705f26d8f92f0fc1b265b20bc389d23cb
* | Merge pull request #30748 from jeremy/redis-rb-4.0.1Jeremy Daer2017-10-083-3/+7
|\ \ | | | | | | redis-rb 4.0 support
| * | redis-rb 4.0 supportJeremy Daer2017-10-083-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | * Use `gem 'redis', '~> 4.0'` for new app Gemfiles * Loosen Action Cable redis-rb dep to `>= 3.3, < 5` * Bump redis-namespace for looser Redis version dep * Avoid using the underlying `redis.client` directly * Use `Redis.new` instead of `Redis.connect`
* | | Distinguish missing adapter gems from load errors within the adapterJeremy Daer2017-10-081-3/+16
|/ / | | | | | | | | | | | | | | * When the adapter is missing, raise an exception that points out config typos and missing Gemfile entries. (We can assume that a non-builtin adapter was used since these are always available.) * When loading an adapter raises a LoadError, prefix its error message to indicate that the adapter is likely missing an optional dependency.