diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-17 12:13:22 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-17 12:13:22 +0100 |
commit | 48f5cecdb03f697a710169ccef1885fcaca70788 (patch) | |
tree | fb0620965261d9a77c5ccbfb158fa86573559384 /railties/test | |
parent | c4f8ce53b1f9af9585aeec9bbb0c66fc9c48ec1b (diff) | |
parent | d15de0cfb86fa3cc1914892b3d16221115a42dee (diff) | |
download | rails-48f5cecdb03f697a710169ccef1885fcaca70788.tar.gz rails-48f5cecdb03f697a710169ccef1885fcaca70788.tar.bz2 rails-48f5cecdb03f697a710169ccef1885fcaca70788.zip |
Merge pull request #22586 from rails/merge-action-cable
Merge Action Cable into master
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/assets_test.rb | 2 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 15 | ||||
-rw-r--r-- | railties/test/generators/actions_test.rb | 9 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 6 |
4 files changed, 29 insertions, 3 deletions
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index 7e9a9a5f3b..7e9213ddc1 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -410,7 +410,7 @@ module ApplicationTests precompile! - assert_equal "Post;\n", File.read(Dir["#{app_path}/public/assets/application-*.js"].first) + assert_match /Post;/, File.read(Dir["#{app_path}/public/assets/application-*.js"].first) end test "initialization on the assets group should set assets_dir" do diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 87e28288ee..b638ca1614 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -1307,6 +1307,21 @@ module ApplicationTests assert_equal 'custom key', Rails.application.config.my_custom_config['key'] end + test "config_for use the Pathname object if it is provided" do + app_file 'config/custom.yml', <<-RUBY + development: + key: 'custom key' + RUBY + + add_to_config <<-RUBY + config.my_custom_config = config_for(Pathname.new(Rails.root.join("config/custom.yml"))) + RUBY + + app 'development' + + assert_equal 'custom key', Rails.application.config.my_custom_config['key'] + end + test "config_for raises an exception if the file does not exist" do add_to_config <<-RUBY config.my_custom_config = config_for('custom') diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index b4fbea4af4..2f42ce894b 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -261,7 +261,14 @@ class ActionsTest < Rails::Generators::TestCase content.gsub!(/^\n/, '') File.open(route_path, "wb") { |file| file.write(content) } - assert_file "config/routes.rb", /\.routes\.draw do\n root 'welcome#index'\nend\n\z/ + + routes = <<-F +Rails.application.routes.draw do + root 'welcome#index' +end +F + + assert_file "config/routes.rb", routes action :route, "resources :product_lines" diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 3f2ac3d2b6..575c1ed1d9 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -376,6 +376,11 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_generator_if_skip_action_cable_is_given + run_generator [destination_root, "--skip-action-cable"] + assert_file "config/application.rb", /#\s+require\s+["']action_cable\/engine["']/ + end + def test_inclusion_of_javascript_runtime run_generator if defined?(JRUBY_VERSION) @@ -613,7 +618,6 @@ class AppGeneratorTest < Rails::Generators::TestCase folders_with_keep = %w( app/assets/images app/mailers - app/models app/controllers/concerns app/models/concerns lib/tasks |