Sha256: 3fb7e35fbee4d7e38183a5dba5118fc75058ccb8983af668b3b94fe8723c7176

Contents?: true

Size: 1.49 KB

Versions: 40

Compression:

Stored size: 1.49 KB

Contents

require 'test_helper'

class ClassGeneratorTest < Test::Unit::TestCase
  include Sprout::TestHelper

  context "a new class generator" do

    setup do
      @temp = File.join(fixtures, 'generators', 'tmp')
      FileUtils.mkdir_p @temp
      @generator = FlashSDK::ClassGenerator.new
      @generator.path = @temp
      @generator.logger = StringIO.new

      Sprout::Generator.register FlashSDK::ClassGenerator
      Sprout::Generator.register FlashSDK::TestClassGenerator
    end

    teardown do
      remove_file @temp
    end

    should "work with a simple class" do
      @generator.input = 'utils.MathUtil'
      @generator.execute
      assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
    end

    should "work with no package" do
      @generator.input = 'MathUtil'
      @generator.execute
      assert_file File.join(@temp, 'src', 'MathUtil.as')
    end

    should "work with directory instead of dots" do
      @generator.input = 'src/utils/MathUtil.as'
      @generator.execute
      assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
    end

    should "work with directory but no source" do
      @generator.input = 'utils/MathUtil.as'
      @generator.execute
      assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
    end

    should "not call TestGenerator when no_test" do
      FlashSDK::TestClassGenerator.any_instance.expects(:manifest).never
      @generator.input = 'utils.MathUtil'
      @generator.test_class = false
      @generator.execute
    end
  end

end

Version data entries

40 entries across 40 versions & 3 rubygems

Version Path
h4oflashsdk-1.0.13 test/unit/class_generator_test.rb
h4oflashsdk-1.0.12 test/unit/class_generator_test.rb
h4oflashsdk-1.0.11 test/unit/class_generator_test.rb
h4oflashsdk-1.0.10 test/unit/class_generator_test.rb
h4oflashsdk-1.0.9 test/unit/class_generator_test.rb
h4oflashsdk-1.0.8 test/unit/class_generator_test.rb
h4oflashsdk-1.0.7 test/unit/class_generator_test.rb
h4oflashsdk-1.0.6 test/unit/class_generator_test.rb
h4oflashsdk-1.0.5 test/unit/class_generator_test.rb
h4oflashsdk-1.0.4 test/unit/class_generator_test.rb
h4oflashsdk-1.0.3 test/unit/class_generator_test.rb
h4oflashsdk-1.0.2 test/unit/class_generator_test.rb
h4oflashsdk-1.0.1 test/unit/class_generator_test.rb
h4oflashsdk-1.0.0 test/unit/class_generator_test.rb
flashsdk_sqe-0.0.14 test/unit/class_generator_test.rb
flashsdk_sqe-0.0.13 test/unit/class_generator_test.rb
flashsdk_sqe-0.0.12 test/unit/class_generator_test.rb
flashsdk_sqe-0.0.11 test/unit/class_generator_test.rb
flashsdk_sqe-0.0.10 test/unit/class_generator_test.rb
flashsdk_sqe-0.0.9 test/unit/class_generator_test.rb