blob: a2a40a28d4116fbbf32883624c8c87fe4c13dcc7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
require 'generators/generators_test_helper'
require 'rails/generators/rails/assets/assets_generator'
# FOXME: Silence the 'Could not find task "using_coffee?"' message in tests due to the public stub
class AssetsGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
arguments %w(posts)
def test_vanilla_assets
run_generator
assert_file "app/assets/javascripts/posts.js"
assert_file "app/assets/stylesheets/posts.css"
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"
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"
end
end
|