Sha256: 1aef1beeb7a9ea281bfc99e1faf152ad3e818b604a53d87df71cd6bfa3c3e882

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

require "test_helper"
require "generators/test_squad/install/install_generator"

class TestSquadEmberTest < Rails::Generators::TestCase
  tests TestSquad::InstallGenerator
  destination Rails.root.join("tmp/generators")
  setup :prepare_destination

  setup do
    @destination_root = self.class.destination_root
    @gemfile_path = @destination_root.join("Gemfile").to_s
    FileUtils.rm_rf(@gemfile_path)
    FileUtils.touch(@gemfile_path)
  end

  teardown do
    FileUtils.rm_rf Rails.root.join("spec")
  end

  test "copy test_squad.rb" do
    run_generator %w[--framework ember]
    assert_file @destination_root.join("test/javascript/test_squad.rb"), /config.framework = "ember"/
  end

  test "create dirs" do
    run_generator %w[--framework ember]
    assert_directory @destination_root.join("test/javascript/unit")
    assert_directory @destination_root.join("test/javascript/routes")
    assert_directory @destination_root.join("test/javascript/models")
    assert_directory @destination_root.join("test/javascript/components")
    assert_directory @destination_root.join("test/javascript/views")
  end

  test "create test helper file" do
    run_generator %w[--framework ember]
    assert_file @destination_root.join("test/javascript/test_helper.js")
  end

  test "copy sample test file" do
    run_generator %w[--framework ember]
    assert_file @destination_root.join("test/javascript/unit/router_test.js")
  end

  test "add gems" do
    run_generator %w[--framework ember]
    assert_file @gemfile_path, /gem 'rails-assets-qunit'/
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
test_squad-0.1.3 test/lib/generators/test_squad/install_generator/ember_test.rb
test_squad-0.1.2 test/lib/generators/test_squad/install_generator/ember_test.rb
test_squad-0.1.1 test/lib/generators/test_squad/install_generator/ember_test.rb
test_squad-0.1.0 test/lib/generators/test_squad/install_generator/ember_test.rb