Skip to content

Commit ce3d973

Browse files
authored
Merge pull request rails#53461 from y-yagi/follow_up_53444
Correctly check whether Action Cable is enabled in `AuthenticationGenerator`
2 parents 1869a5a + 6f0d51e commit ce3d973

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

railties/lib/rails/generators/rails/authentication/authentication_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def create_authentication_files
1919
template "app/controllers/concerns/authentication.rb"
2020
template "app/controllers/passwords_controller.rb"
2121

22-
template "app/channels/application_cable/connection.rb" unless options.skip_action_cable?
22+
template "app/channels/application_cable/connection.rb" if defined?(ActionCable::Engine)
2323

2424
template "app/mailers/passwords_mailer.rb"
2525

railties/test/generators/authentication_generator_test.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,14 @@ def test_model_test_is_skipped_if_test_framework_is_given
108108
end
109109

110110
def test_connection_class_skipped_without_action_cable
111-
generator([destination_root], skip_action_cable: true)
112-
111+
old_value = ActionCable.const_get(:Engine)
112+
ActionCable.send(:remove_const, :Engine)
113+
generator([destination_root])
113114
run_generator_instance
114115

115116
assert_no_file "app/channels/application_cable/connection.rb"
117+
ensure
118+
ActionCable.const_set(:Engine, old_value)
116119
end
117120

118121
private

0 commit comments

Comments
 (0)