1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix assets generators.

This commit is contained in:
José Valim 2011-04-17 11:48:15 +02:00
parent 3a68aec1a1
commit a9a2035722
2 changed files with 11 additions and 16 deletions

View file

@ -24,6 +24,7 @@ module Rails
:rails => {
:actions => '-a',
:orm => '-o',
:javascripts => '-j',
:javascript_engine => '-je',
:resource_controller => '-c',
:scaffold_controller => '-c',

View file

@ -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