From a9a20357220309e3bc7d06c5eac5619ca34b8c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 17 Apr 2011 11:48:15 +0200 Subject: [PATCH] Fix assets generators. --- railties/lib/rails/generators.rb | 1 + .../test/generators/assets_generator_test.rb | 26 +++++++------------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 82171d0832..9be395e989 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -24,6 +24,7 @@ module Rails :rails => { :actions => '-a', :orm => '-o', + :javascripts => '-j', :javascript_engine => '-je', :resource_controller => '-c', :scaffold_controller => '-c', diff --git a/railties/test/generators/assets_generator_test.rb b/railties/test/generators/assets_generator_test.rb index a2a40a28d4..e99f0f092a 100644 --- a/railties/test/generators/assets_generator_test.rb +++ b/railties/test/generators/assets_generator_test.rb @@ -6,27 +6,21 @@ class AssetsGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper arguments %w(posts) - def test_vanilla_assets + def test_assets run_generator - assert_file "app/assets/javascripts/posts.js" - assert_file "app/assets/stylesheets/posts.css" + assert_file "app/assets/javascripts/posts.js.coffee" + assert_file "app/assets/stylesheets/posts.css.scss" end def test_skipping_assets - content = run_generator ["posts", "--skip-assets"] - assert_no_file "app/assets/javascripts/posts.js" - assert_no_file "app/assets/stylesheets/posts.css" + content = run_generator ["posts", "--no-stylesheets", "--no-javascripts"] + assert_no_file "app/assets/javascripts/posts.js.coffee" + assert_no_file "app/assets/stylesheets/posts.css.scss" end - def test_coffee_javascript - self.generator_class.any_instance.stubs(:using_coffee?).returns(true) - run_generator - assert_file "app/assets/javascripts/posts.js.coffee" - end - - def test_sass_stylesheet - self.generator_class.any_instance.stubs(:using_sass?).returns(true) - run_generator - assert_file "app/assets/stylesheets/posts.css.scss" + def test_vanilla_assets + run_generator ["posts", "--no-javascript-engine", "--no-stylesheet-engine"] + assert_file "app/assets/javascripts/posts.js" + assert_file "app/assets/stylesheets/posts.css" end end