Sha256: f4d9aee50cebebc587180f52a41de4bab7a1b0ab530fea3009fed047f5d09070

Contents?: true

Size: 1.47 KB

Versions: 12

Compression:

Stored size: 1.47 KB

Contents

require File.join(File.dirname(__FILE__), "test_generator_helper.rb")

class TestExtconfGenerator < Test::Unit::TestCase
  include RubiGen::GeneratorTestHelper

  def setup
    bare_setup
  end

  def teardown
    bare_teardown
  end

  def test_generator_without_options
    name = "my_ext"
    run_generator('extconf', [name], sources)
    assert_directory_exists("ext/my_ext")
    assert_directory_exists("tasks/extconf")
    assert_generated_file("ext/my_ext/extconf.rb")
    assert_generated_file("ext/my_ext/my_ext.c")
    assert_generated_file("tasks/extconf.rake")
    assert_generated_file("tasks/extconf/my_ext.rake")
    assert_generated_file("test/test_my_ext_extn.rb")
    assert_generated_file(".autotest")
  end

  def test_generator_for_rspec_project
    name = "my_ext"
    FileUtils.mkdir_p(File.join(APP_ROOT, 'spec'))
    `touch #{APP_ROOT}/spec/spec_helper.rb`
    run_generator('extconf', [name], sources)
    assert_directory_exists("ext/my_ext")
    assert_directory_exists("tasks/extconf")
    assert_generated_file("ext/my_ext/extconf.rb")
    assert_generated_file("ext/my_ext/my_ext.c")
    assert_generated_file("tasks/extconf.rake")
    assert_generated_file("tasks/extconf/my_ext.rake")
    assert_generated_file("spec/my_ext_extn_spec.rb")
    assert_generated_file(".autotest")
  end

  private
  def sources
    [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
    ]
  end

  def generator_path
    "rubygems_generators"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
newgem-1.5.3 test/test_extconf_generator.rb
newgem-1.5.0 test/test_extconf_generator.rb
newgem-1.5.1 test/test_extconf_generator.rb
newgem-1.5.2 test/test_extconf_generator.rb
newgem-1.1.0 test/test_extconf_generator.rb
newgem-1.2.0 test/test_extconf_generator.rb
newgem-1.3.0 test/test_extconf_generator.rb
newgem-1.2.3 test/test_extconf_generator.rb
newgem-1.2.2 test/test_extconf_generator.rb
newgem-1.2.1 test/test_extconf_generator.rb
newgem-1.4.0 test/test_extconf_generator.rb
newgem-1.4.1 test/test_extconf_generator.rb