test/test_newgem_generator.rb in newgem-0.22.2 vs test/test_newgem_generator.rb in newgem-0.23.0

- old
+ new

@@ -1,133 +1,133 @@ require File.join(File.dirname(__FILE__), "test_generator_helper.rb") class TestNewgemGenerator < Test::Unit::TestCase include RubiGen::GeneratorTestHelper - + attr_reader :gem_name def setup bare_setup @gem_name = File.basename(File.expand_path(APP_ROOT)) end - + def teardown bare_teardown end - + def test_newgem run_generator('newgem', [APP_ROOT], sources) assert_directory_exists "config" assert_directory_exists "lib" assert_directory_exists "log" assert_directory_exists "tasks" assert_directory_exists "test" - - %w[Rakefile README.txt History.txt License.txt Manifest.txt].each do |file| + + %w[Rakefile README.txt History.txt License.txt Manifest.txt PostInstall.txt].each do |file| assert_generated_file(file) end - + %w[hoe.rb requirements.rb].each do |file| assert_generated_file("config/#{file}") end - + assert_generated_file("lib/#{gem_name}.rb") assert_generated_file("lib/#{gem_name}/version.rb") - + ["test_helper.rb", "test_#{gem_name}.rb"].each do |file| assert_generated_file("test/#{file}") end - + %w[generate destroy console].each do |file| assert_generated_file("script/#{file}") end - + assert_generated_module("lib/#{gem_name}") - + %w[deployment environment website].each do |file| assert_generated_file("tasks/#{file}.rake") end - + assert_manifest_complete end def test_newgem_with_website_by_default run_generator('newgem', [APP_ROOT], sources) - + %w[txt2html].each do |file| assert_generated_file("script/#{file}") end - + %w[index.txt index.html template.html.erb stylesheets/screen.css javascripts/rounded_corners_lite.inc.js].each do |file| assert_generated_file("website/#{file}") end - + assert_manifest_complete end def test_newgem_with_no_website run_generator('newgem', [APP_ROOT], sources, {:disable_website => true}) - + assert !File.exists?("#{APP_ROOT}/script/txt2html"), "No script/txt2html should be generated" assert !File.exists?("#{APP_ROOT}/website"), "No website folder should be generated" - + assert_manifest_complete end def test_newgem_with_executable @executables = ["some_executable", "another"] run_generator('newgem', [APP_ROOT], sources, {:bin_name => @executables.join(',')}) - + @executables.each do |exec| - assert_generated_file("bin/#{exec}") + assert_generated_file("bin/#{exec}") end - + assert_manifest_complete end - + def test_newgem_with_rspec run_generator('newgem', [APP_ROOT], sources, {:test_framework => "rspec"}) assert_directory_exists("spec") assert_directory_exists("tasks") assert_generated_file("spec/#{gem_name}_spec.rb") assert_generated_file("spec/spec_helper.rb") assert_generated_file("tasks/rspec.rake") - + assert_manifest_complete end - + def test_newgem_with_jruby run_generator('newgem', [APP_ROOT], sources, {:jruby => true}) assert_directory_exists("tasks") assert_generated_file("tasks/jruby.rake") - + assert_manifest_complete end - + def test_run_in_trunk_path_finds_parent_path_for_gem_name expected_gem_name = File.basename(File.expand_path(APP_ROOT)) app_root = File.join(APP_ROOT, "trunk") FileUtils.mkdir_p app_root generator = run_generator('newgem', [app_root], sources) assert_equal(expected_gem_name, generator.gem_name) end - + private def sources [ RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)), RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", "newgem_generators")), RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", "newgem_theme_generators")), RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", "rubygems_generators")) ] end - + def generator_path "app_generators" end - + def assert_manifest_complete files = app_root_files.sort files.reject! { |file| File.directory?(file) } files.map! { |path| path.sub("#{APP_ROOT}/","") } files.reject! { |file| /^#{APP_ROOT}/ =~ file }