diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2019-01-16 15:28:13 +0000 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2019-01-16 16:34:34 +0000 |
commit | d7097cf5e00faf2ac4d02bd1a5c37801671ce70c (patch) | |
tree | 3a864ab7a55a95f032e4e4b9afbcbf1d24d1bdeb | |
parent | a43052cbbcb4f6671cf16fa45c906984fe601fa0 (diff) | |
download | rails-d7097cf5e00faf2ac4d02bd1a5c37801671ce70c.tar.gz rails-d7097cf5e00faf2ac4d02bd1a5c37801671ce70c.tar.bz2 rails-d7097cf5e00faf2ac4d02bd1a5c37801671ce70c.zip |
Add `rails test:channels`.
Add this rake task to test channels only.
We've added `rails test:mailboxes` recently in the same way #34828.
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 2 | ||||
-rw-r--r-- | railties/test/application/test_runner_test.rb | 15 |
3 files changed, 18 insertions, 3 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index aca55fae80..3691bb3fb1 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,7 @@ +* Add `rails test:channels`. + + *bogdanvlviv* + * Use original `bundler` environment variables during the process of generating a new rails project. *Marco Costa* diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index ecc458b21e..3a1b62d9d1 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -28,7 +28,7 @@ namespace :test do desc "Run tests quickly, but also reset db" task db: %w[db:test:prepare test] - ["models", "helpers", "controllers", "mailers", "integration", "jobs", "mailboxes"].each do |name| + ["models", "helpers", "channels", "controllers", "mailers", "integration", "jobs", "mailboxes"].each do |name| task name => "test:prepare" do $: << "test" Rails::TestUnit::Runner.rake_run(["test/#{name}"]) diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index 6765eef9d0..fda6df500d 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -98,6 +98,17 @@ module ApplicationTests end end + def test_run_channels + create_test_file :channels, "foo_channel" + create_test_file :channels, "bar_channel" + + rails("test:channels").tap do |output| + assert_match "FooChannelTest", output + assert_match "BarChannelTest", output + assert_match "2 runs, 2 assertions, 0 failures", output + end + end + def test_run_controllers create_test_file :controllers, "foo_controller" create_test_file :controllers, "bar_controller" @@ -167,11 +178,11 @@ module ApplicationTests end def test_run_all_suites - suites = [:models, :helpers, :unit, :controllers, :mailers, :functional, :integration, :jobs, :mailboxes] + suites = [:models, :helpers, :unit, :channels, :controllers, :mailers, :functional, :integration, :jobs, :mailboxes] suites.each { |suite| create_test_file suite, "foo_#{suite}" } run_test_command("") .tap do |output| suites.each { |suite| assert_match "Foo#{suite.to_s.camelize}Test", output } - assert_match "9 runs, 9 assertions, 0 failures", output + assert_match "10 runs, 10 assertions, 0 failures", output end end |