Sha256: 2e916b981804eb0bbe6786be46bb1face55904dd58273b6dbb84c89dbde8f1c4

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

require 'test_helper'
require 'generators/ember/bootstrap_generator'

class BootstrapGeneratorTest < Rails::Generators::TestCase
  include GeneratorTestSupport

  tests Ember::Generators::BootstrapGenerator
  destination File.join(Rails.root, "tmp", "generator_test_output")

  setup :prepare_destination

  test "Assert folder layout and .gitkeep files are properly created" do
    run_generator []
    assert_new_dirs
  end

  test "create bootstrap" do
    run_generator []
    assert_file "#{ember_path}/ember-app.js.es6"
    assert_file "#{ember_path}/router.js.es6"
  end

  test "create bootstrap with and custom path" do
    custom_path = ember_path("custom")
    run_generator ["-d", custom_path]
    assert_file "#{custom_path}/ember-app.js.es6"
    assert_file "#{custom_path}/router.js.es6"
  end

  test "create bootstrap with custom app name" do
    run_generator ["-n", "MyApp"]
    assert_file "#{ember_path}/ember-app.js.es6", /MyApp = /
    assert_file "#{ember_path}/router.js.es6"
  end

  test "Uses config.ember.app_name" do
    with_config app_name: 'Blazorz' do
      run_generator
      assert_file "#{ember_path}/ember-app.js.es6", /Blazorz = /
      assert_file "#{ember_path}/router.js.es6"
    end
  end

  test "Uses config.ember.ember_path" do
    custom_path = ember_path("custom")

    with_config ember_path: custom_path do
      run_generator
      assert_file "#{custom_path}/ember-app.js.es6"
      assert_file "#{custom_path}/router.js.es6"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ember-appkit-rails-0.1.2 test/generators/bootstrap_generator_test.rb
ember-appkit-rails-0.1.1 test/generators/bootstrap_generator_test.rb