aboutsummaryrefslogblamecommitdiffstats
path: root/railties/test/generators/assets_generator_test.rb
blob: 375632e5bcf2f46156f3836177d8901854183a89 (plain) (tree)
1
2
3
4
5
6
7
8
9


                                                        
                                                                                                  



                                                       
                 
                 

                                                        


                          


                                                                             

     



                                                                               

     
require 'generators/generators_test_helper'
require 'rails/generators/rails/assets/assets_generator'

# FIXME: 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_assets
    run_generator
    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", "--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_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