Sha256: c7afda0a8dddb38d6f5dccc12eb681e21297d5482ad476dfb1dedbcf7c685015

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

require 'test_helper'
require 'generators/generators_test_helper'
require 'generators/boilerplate/install/install_generator'

class InstallGeneratorTest < Rails::Generators::TestCase
  include GeneratorsTestHelper
  tests Boilerplate::Generators::InstallGenerator

  def setup
    mkdir_p "#{destination_root}/app/assets/stylesheets"
    mkdir_p "#{destination_root}/app/assets/javascripts"
    cp fixture("application.css"), "#{destination_root}/app/assets/stylesheets"
    cp fixture("application.js"), "#{destination_root}/app/assets/javascripts"
    super
  end

  test "copies index.html to app/views/layouts/application.html.erb" do
    run_generator

    assert_file 'app/views/layouts/application.html.erb'
  end

  test "adds reset.css to the top of the application.css" do
    run_generator

    assert_file 'app/assets/stylesheets/application.css' do |application|
      assert_match /require reset.*require_self/m, application
    end
  end

  test "adds plugins.js to the top of the application.js" do
    run_generator

    assert_file "app/assets/javascripts/application.js" do |application|
      assert_match /\/\/= require plugins[^\/]+\/\/= require jquery/m, application
    end

  end

  test "copies public files" do
    run_generator

    %w{robots.txt crossdomain.xml humans.txt favicon.ico apple-touch-icon-114x114-precomposed.png apple-touch-icon-57x57-precomposed.png apple-touch-icon-72x72-precomposed.png apple-touch-icon-precomposed.png apple-touch-icon.png}.each do |f|
      assert_file "public/#{f}"
    end
  end

  def fixture(file)
    File.expand_path("fixtures/#{file}", File.dirname(__FILE__))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-boilerplate-0.1.5 test/generators/install_generator_test.rb
rails-boilerplate-0.1.4 test/generators/install_generator_test.rb
rails-boilerplate-0.1.3 test/generators/install_generator_test.rb
rails-boilerplate-0.1.2 test/generators/install_generator_test.rb
rails-boilerplate-0.1.1 test/generators/install_generator_test.rb
rails-boilerplate-0.1.0 test/generators/install_generator_test.rb