Sha256: 7dbb04183d92544c57667256eb8da4a4f803b9096eeb730ef6bd4e60a05aa8da

Contents?: true

Size: 1.76 KB

Versions: 3

Compression:

Stored size: 1.76 KB

Contents

require 'test_helper'
require 'generators/ember/component_generator'

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

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

  setup :prepare_destination

  test "default_component" do
    run_generator ["PostChart"]
    assert_file "#{app_path}/components/post-chart_component.js.es6"
    assert_file "#{app_path}/templates/components/post-chart.hbs"
  end

  test "Assert files are properly created (CamelCase)" do
    run_generator %w(PostChart)
    assert_file "#{app_path}/components/post-chart_component.js.es6"
    assert_file "#{app_path}/templates/components/post-chart.hbs"
  end

  test "Assert object names are properly created with CamelCase name" do
    run_generator %w(PostChart)
    assert_file "#{app_path}/components/post-chart_component.js.es6"
    assert_file "#{app_path}/templates/components/post-chart.hbs"
  end

  test "Assert files are properly created (lower-case)" do
    run_generator %w(post-chart)
    assert_file "#{app_path}/components/post-chart_component.js.es6"
    assert_file "#{app_path}/templates/components/post-chart.hbs"
  end

  test "Assert object names are properly created with lower-case name" do
    run_generator %w(post-chart)
    assert_file "#{app_path}/components/post-chart_component.js.es6"
    assert_file "#{app_path}/templates/components/post-chart.hbs"
  end

  test "Uses config.ember.appkit.paths.app" do
    custom_path = app_path("custom")

    with_config paths: {app: custom_path} do
      run_generator ["PostChart"]
      assert_file "#{custom_path}/components/post-chart_component.js.es6"
      assert_file "#{custom_path}/templates/components/post-chart.hbs"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ember-appkit-rails-0.2.2 test/generators/component_generator_test.rb
ember-appkit-rails-0.2.1 test/generators/component_generator_test.rb
ember-appkit-rails-0.2.0 test/generators/component_generator_test.rb