Sha256: cd2e51dc3e47887c9c8097f6509f70cd2f40b325bf39a079901d912796283b14

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

require "test_helper"
require "generators/html5/install/install_generator"

class InstallGeneratorTest < Rails::Generators::TestCase
  include GeneratorTestHelper
  tests Html5::Generators::InstallGenerator

  test "Compass config file should be generated" do
    run_generator
    assert_file "config/compass.rb"
  end

  test "html5_rails.yml config file should be generated" do
    run_generator
    assert_file "config/html5_rails.yml"
  end
  
  test "application layout should be generated" do
    run_generator
    assert_file "app/views/layouts/application.html.erb"
  end

  test "with flag --template-engine=haml" do
    run_generator ["--template-engine=haml"]
    assert_no_file "app/views/layouts/application.html.erb"
    assert_file "app/views/layouts/application.html.haml"
  end

  test "minimal application partials should be generated" do
    run_generator
    %w(_footer _head _header).each do |file|
      assert_file "app/views/application/#{ file }.html.erb"
    end
    %w(_flashes _javascripts _stylesheets).each do |file|
      assert_no_file "app/views/application/#{ file }.html.erb"
    end
  end

  test "assets should be generated" do
    run_generator

    assert_file "app/assets/stylesheets/_defaults.css.scss"
    assert_file "app/assets/stylesheets/application.css.scss", /@import "application\/document";/
    %w(_defaults document media_queries).each do |file|
      assert_file "app/assets/stylesheets/application/#{ file }.css.scss"
    end
  end

  test "application.css gets removed" do
    run_generator
    assert_no_file "app/assets/stylesheets/application.css"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
html5-rails-0.0.4 test/generators/install_generator_test.rb
html5-rails-0.0.3 test/generators/install_generator_test.rb