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:
parent
3a68aec1a1
commit
a9a2035722
2 changed files with 11 additions and 16 deletions
|
@ -24,6 +24,7 @@ module Rails
|
||||||
:rails => {
|
:rails => {
|
||||||
:actions => '-a',
|
:actions => '-a',
|
||||||
:orm => '-o',
|
:orm => '-o',
|
||||||
|
:javascripts => '-j',
|
||||||
:javascript_engine => '-je',
|
:javascript_engine => '-je',
|
||||||
:resource_controller => '-c',
|
:resource_controller => '-c',
|
||||||
:scaffold_controller => '-c',
|
:scaffold_controller => '-c',
|
||||||
|
|
|
@ -6,27 +6,21 @@ class AssetsGeneratorTest < Rails::Generators::TestCase
|
||||||
include GeneratorsTestHelper
|
include GeneratorsTestHelper
|
||||||
arguments %w(posts)
|
arguments %w(posts)
|
||||||
|
|
||||||
def test_vanilla_assets
|
def test_assets
|
||||||
run_generator
|
run_generator
|
||||||
assert_file "app/assets/javascripts/posts.js"
|
assert_file "app/assets/javascripts/posts.js.coffee"
|
||||||
assert_file "app/assets/stylesheets/posts.css"
|
assert_file "app/assets/stylesheets/posts.css.scss"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_skipping_assets
|
def test_skipping_assets
|
||||||
content = run_generator ["posts", "--skip-assets"]
|
content = run_generator ["posts", "--no-stylesheets", "--no-javascripts"]
|
||||||
assert_no_file "app/assets/javascripts/posts.js"
|
assert_no_file "app/assets/javascripts/posts.js.coffee"
|
||||||
assert_no_file "app/assets/stylesheets/posts.css"
|
assert_no_file "app/assets/stylesheets/posts.css.scss"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_coffee_javascript
|
def test_vanilla_assets
|
||||||
self.generator_class.any_instance.stubs(:using_coffee?).returns(true)
|
run_generator ["posts", "--no-javascript-engine", "--no-stylesheet-engine"]
|
||||||
run_generator
|
assert_file "app/assets/javascripts/posts.js"
|
||||||
assert_file "app/assets/javascripts/posts.js.coffee"
|
assert_file "app/assets/stylesheets/posts.css"
|
||||||
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"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue