aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-02-22 22:48:18 -0300
committerRafael França <rafaelmfranca@gmail.com>2016-02-22 22:48:18 -0300
commitb86bf3929c0cbbee2bd9b4bd0f6460bd7ba99e7b (patch)
tree356c0b41b384dbcaf1c22e26ee06ccac058507d2 /railties/test
parente7299497871e20c3a28516a4e84fe1789c8795a8 (diff)
parentcf423f8f767895d608284acb3543f7c9ba15ccf4 (diff)
downloadrails-b86bf3929c0cbbee2bd9b4bd0f6460bd7ba99e7b.tar.gz
rails-b86bf3929c0cbbee2bd9b4bd0f6460bd7ba99e7b.tar.bz2
rails-b86bf3929c0cbbee2bd9b4bd0f6460bd7ba99e7b.zip
Merge pull request #23600 from maclover7/actioncable-work
Assorted Railties generators work
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/channel_generator_test.rb12
-rw-r--r--railties/test/generators/model_generator_test.rb8
2 files changed, 20 insertions, 0 deletions
diff --git a/railties/test/generators/channel_generator_test.rb b/railties/test/generators/channel_generator_test.rb
index c1f0c03fbf..e31736a74c 100644
--- a/railties/test/generators/channel_generator_test.rb
+++ b/railties/test/generators/channel_generator_test.rb
@@ -5,6 +5,18 @@ class ChannelGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
tests Rails::Generators::ChannelGenerator
+ def test_application_cable_skeleton_is_created
+ run_generator ['books']
+
+ assert_file "app/channels/application_cable/channel.rb" do |cable|
+ assert_match(/module ApplicationCable\n class Channel < ActionCable::Channel::Base\n/, cable)
+ end
+
+ assert_file "app/channels/application_cable/connection.rb" do |cable|
+ assert_match(/module ApplicationCable\n class Connection < ActionCable::Connection::Base\n/, cable)
+ end
+ end
+
def test_channel_is_created
run_generator ['chat']
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index c8c8f0aa3b..ed6846abc3 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -6,6 +6,14 @@ class ModelGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
arguments %w(Account name:string age:integer)
+ def test_application_record_skeleton_is_created
+ run_generator
+ assert_file "app/models/application_record.rb" do |record|
+ assert_match(/class ApplicationRecord < ActiveRecord::Base/, record)
+ assert_match(/self.abstract_class = true/, record)
+ end
+ end
+
def test_help_shows_invoked_generators_options
content = run_generator ["--help"]
assert_match(/ActiveRecord options:/, content)