diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2019-01-16 15:14:35 +0000 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2019-01-16 15:14:35 +0000 |
commit | a43052cbbcb4f6671cf16fa45c906984fe601fa0 (patch) | |
tree | a1956541481fae746541cdd968181a4bf1c6287e | |
parent | d67863af390b45ed8dde551071a29b3d347bb8be (diff) | |
download | rails-a43052cbbcb4f6671cf16fa45c906984fe601fa0.tar.gz rails-a43052cbbcb4f6671cf16fa45c906984fe601fa0.tar.bz2 rails-a43052cbbcb4f6671cf16fa45c906984fe601fa0.zip |
Remove `frozen_string_literal` from Action Cable's template files
Related to 837f602fa1b3281113dac965a8ef96de3cac8b02
Fix the testing guide.
3 files changed, 4 insertions, 10 deletions
diff --git a/actioncable/lib/rails/generators/test_unit/templates/channel_test.rb.tt b/actioncable/lib/rails/generators/test_unit/templates/channel_test.rb.tt index 301dc0b6fe..7307654611 100644 --- a/actioncable/lib/rails/generators/test_unit/templates/channel_test.rb.tt +++ b/actioncable/lib/rails/generators/test_unit/templates/channel_test.rb.tt @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require "test_helper" class <%= class_name %>ChannelTest < ActionCable::Channel::TestCase diff --git a/guides/source/testing.md b/guides/source/testing.md index 576c4d768c..1a2f480407 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -1735,14 +1735,14 @@ Testing Action Cable -------------------- Since Action Cable is used at different levels inside your application, -you'll need to test both the channels and connection classes themsleves and that other +you'll need to test both the channels, connection classes themselves, and that other entities broadcast correct messages. ### Connection Test Case By default, when you generate new Rails application with Action Cable, a test for the base connection class (`ApplicationCable::Connection`) is generated as well under `test/channels/application_cable` directory. -Connection tests aim to check whether a connection's identifiers gets assigned properly +Connection tests aim to check whether a connection's identifiers get assigned properly or that any improper connection requests are rejected. Here is an example: ```ruby @@ -1765,9 +1765,8 @@ end You can also specify request cookies the same way you do in integration tests: - ```ruby -test "connects with_cookies" do +test "connects with cookies" do cookies.signed[:user_id] = "42" connect @@ -1778,7 +1777,6 @@ end See the API documentation for [`AcionCable::Connection::TestCase`](http://api.rubyonrails.org/classes/ActionCable/Connection/TestCase.html) for more information. - ### Channel Test Case By default, when you generate a channel, an associated test will be generated as well @@ -1823,7 +1821,7 @@ See the API documentation for [`AcionCable::Channel::TestCase`](http://api.rubyo Action Cable ships with a bunch of custom assertions that can be used to lessen the verbosity of tests. For a full list of available assertions, see the API documentation for [`ActionCable::TestHelper`](http://api.rubyonrails.org/classes/ActionCable/TestHelper.html). -It's a good practice to ensure that the correct message has been broadcasted inside another components (e.g. inside your controllers). This is precisely where +It's a good practice to ensure that the correct message has been broadcasted inside other components (e.g. inside your controllers). This is precisely where the custom assertions provided by Action Cable are pretty useful. For instance, within a model: diff --git a/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt b/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt index cc8337fc6d..800405f15e 100644 --- a/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt @@ -1,5 +1,3 @@ -# frozen_string_literal: true - require "test_helper" class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase |