Sha256: cbb3ea1bfe940f1ec4180f566ccfefd1d7ee2176438f6d91888f01acaf18378b

Contents?: true

Size: 1.54 KB

Versions: 14

Compression:

Stored size: 1.54 KB

Contents

require 'test/unit'
require 'rant/rantlib'
require 'tutil'

$testPluginConfigureDir = File.expand_path(File.dirname(__FILE__))

class TestPluginConfigure < Test::Unit::TestCase
    def setup
	# Ensure we run in test directory.
	Dir.chdir($testPluginConfigureDir) unless Dir.pwd == $testPluginConfigureDir
    end
    def teardown
	capture_std do
	    assert_equal(Rant.run("clean"), 0)
	end
	assert(!File.exist?("hello"),
	    "hello should have been removed by `clean'")
	assert(!File.exist?("config"),
	    "config should have been removed by `clean'")
    end
    def test_startup
	capture_std do
	    assert_equal(Rant.run([]), 0)
	end
	assert(File.exist?("hello"),
	    "target `hello' is first, and should have been run")
	assert(!File.exist?("config"),
	    "config should have used defaults, no writing")
    end
    def test_configure
	capture_std do
	    assert_equal(0, Rant.run("configure"))
	end
	assert(File.exist?("config"),
	    "config should have been created by `configure'")
	capture_std do
	    assert_equal(Rant.run("value_a_guess"), 0,
		"value_a_guess should be choosen based on config")
	end
	assert(File.exist?("value_a_guess"))
    end
    def test_configure_immediate
	capture_std do
	    assert_equal(Rant.run(%w(configure value_a)), 0,
		"on task creation time, conf['a'] had the value `value_a'")
	end
	assert(!File.exist?("value_a_guess"))
	assert(File.exist?("value_a"))
    end
    def test_defaults
	capture_std do
	    assert_equal(Rant.run("value_a"), 0)
	end
	assert(File.exist?("value_a"))
	assert(!File.exist?("value_a_guess"))
    end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rant-0.4.6 test/plugin/configure/test_configure.rb
rant-0.3.4 test/plugin/configure/test_configure.rb
rant-0.3.6 test/plugin/configure/test_configure.rb
rant-0.3.8 test/plugin/configure/test_configure.rb
rant-0.4.0 test/plugin/configure/test_configure.rb
rant-0.4.2 test/plugin/configure/test_configure.rb
rant-0.4.8 test/plugin/configure/test_configure.rb
rant-0.5.0 test/plugin/configure/test_configure.rb
rant-0.5.2 test/plugin/configure/test_configure.rb
rant-0.5.4 test/plugin/configure/test_configure.rb
rant-0.5.6 test/plugin/configure/test_configure.rb
rant-0.3.2 test/plugin/configure/test_configure.rb
rant-0.4.4 test/plugin/configure/test_configure.rb
rant-0.5.7 test/plugin/configure/test_configure.rb