Sha256: 13700747bd439cd07fcdb26136ffa227b8b17ebdda2f6589c7d946824b683f73

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require "test_helper"

class ComponentGeneratorTest < Rails::Generators::TestCase
  tests MountainView::Generators::ComponentGenerator

  destination File.expand_path("../../tmp", __FILE__)
  setup :prepare_destination

  test "Assert all files are properly created" do
    run_generator %w( widget )

    assert_file "app/components/widget/_widget.html.erb"
    assert_file "app/components/widget/widget.css"
    assert_file "app/components/widget/widget.js"
    assert_file "app/components/widget/widget.yml"
    # Delete generated files so the test don't fail if the order is random
    FileUtils.remove_dir(File.expand_path("../../tmp", __FILE__))
  end

  test "Generates different engines" do
    Rails.application.config.app_generators.template_engine :haml
    Rails.application.config.app_generators.stylesheet_engine :scss
    Rails.application.config.app_generators.javascript_engine :coffee

    run_generator %w( widget )

    assert_file "app/components/widget/_widget.html.haml"
    assert_file "app/components/widget/widget.scss"
    assert_file "app/components/widget/widget.coffee"
    assert_file "app/components/widget/widget.yml"
    # Delete generated files so the test don't fail if the order is random
    FileUtils.remove_dir(File.expand_path("../../tmp", __FILE__))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mountain_view-0.8.1 test/generators/component_generator_test.rb
mountain_view-0.8.0 test/generators/component_generator_test.rb