aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2019-01-16 22:00:51 +0100
committerGitHub <noreply@github.com>2019-01-16 22:00:51 +0100
commitcb3f78aa7c8f14921501703ed0780f2a428bc6a1 (patch)
tree8eb4807d949160d38a3d239ea33d37318d38b5aa /railties/test/generators
parentd49899c15431104f8dad374363bac57479b4bd39 (diff)
parent7e52e3b1c004eb22521c844b6adf69a2689cc1da (diff)
downloadrails-cb3f78aa7c8f14921501703ed0780f2a428bc6a1.tar.gz
rails-cb3f78aa7c8f14921501703ed0780f2a428bc6a1.tar.bz2
rails-cb3f78aa7c8f14921501703ed0780f2a428bc6a1.zip
Merge branch 'master' into db_system_change_command
Diffstat (limited to 'railties/test/generators')
-rw-r--r--railties/test/generators/app_generator_test.rb3
-rw-r--r--railties/test/generators/channel_generator_test.rb14
-rw-r--r--railties/test/generators/shared_generator_tests.rb4
3 files changed, 19 insertions, 2 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 839e6feb39..e0cd7f90ce 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -81,6 +81,7 @@ DEFAULT_APP_FILES = %w(
test/test_helper.rb
test/fixtures
test/fixtures/files
+ test/channels/application_cable/connection_test.rb
test/controllers
test/models
test/helpers
@@ -363,6 +364,8 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "#{app_root}/config/environments/production.rb" do |content|
assert_no_match(/config\.action_cable/, content)
end
+
+ assert_no_file "#{app_root}/test/channels/application_cable/connection_test.rb"
end
def test_app_update_does_not_generate_bootsnap_contents_when_skip_bootsnap_is_given
diff --git a/railties/test/generators/channel_generator_test.rb b/railties/test/generators/channel_generator_test.rb
index 1cb8465539..1a25422c3c 100644
--- a/railties/test/generators/channel_generator_test.rb
+++ b/railties/test/generators/channel_generator_test.rb
@@ -67,12 +67,23 @@ class ChannelGeneratorTest < Rails::Generators::TestCase
assert_file "app/javascript/channels/consumer.js"
end
+ def test_invokes_default_test_framework
+ run_generator %w(chat -t=test_unit)
+
+ assert_file "test/channels/chat_channel_test.rb" do |test|
+ assert_match(/class ChatChannelTest < ActionCable::Channel::TestCase/, test)
+ assert_match(/# test "subscribes" do/, test)
+ assert_match(/# assert subscription.confirmed\?/, test)
+ end
+ end
+
def test_channel_on_revoke
run_generator ["chat"]
run_generator ["chat"], behavior: :revoke
assert_no_file "app/channels/chat_channel.rb"
assert_no_file "app/javascript/channels/chat_channel.js"
+ assert_no_file "test/channels/chat_channel_test.rb"
assert_file "app/channels/application_cable/channel.rb"
assert_file "app/channels/application_cable/connection.rb"
@@ -88,5 +99,8 @@ class ChannelGeneratorTest < Rails::Generators::TestCase
assert_no_file "app/javascript/channels/chat_channel_channel.js"
assert_file "app/javascript/channels/chat_channel.js"
+
+ assert_no_file "test/channels/chat_channel_channel_test.rb"
+ assert_file "test/channels/chat_channel_test.rb"
end
end
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb
index 4dfcb35ad9..f673832caa 100644
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -206,7 +206,7 @@ module SharedGeneratorTests
unless generator_class.name == "Rails::Generators::PluginGenerator"
assert_file "#{application_path}/app/javascript/packs/application.js" do |content|
- assert_match(/^import \* as ActiveStorage from "activestorage"\nActiveStorage.start\(\)/, content)
+ assert_match(/^import \* as ActiveStorage from "@rails\/activestorage"\nActiveStorage.start\(\)/, content)
end
end
@@ -267,7 +267,7 @@ module SharedGeneratorTests
assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']active_storage\/engine["']/
assert_file "#{application_path}/app/javascript/packs/application.js" do |content|
- assert_no_match(/^import * as ActiveStorage from "activestorage"\nActiveStorage.start\(\)/, content)
+ assert_no_match(/^import * as ActiveStorage from "@rails\/activestorage"\nActiveStorage.start\(\)/, content)
end
assert_file "#{application_path}/config/environments/development.rb" do |content|