require File.join(File.dirname(__FILE__), 'test_helper') class FlashPlayerTaskTest < Test::Unit::TestCase include SproutTestCase context "A FlashPlayerTask" do setup do # Force reload of the Specification on each # test method b/c SproutTestCase calls # Executable.clear_entities! but 'require' # only runs once per VM run... load 'flashplayer/specification.rb' @swf = File.join(fixtures, 'AsUnit4.swf') end should "work with swf as task name" do t = flashplayer @swf configure_task t t.invoke end should "work with swf in block" do t = flashplayer :run do |t| t.input = @swf end configure_task t t.invoke assert_equal @swf, t.input end should "work with swf as prerequisite" do t = flashplayer :run => @swf configure_task t t.invoke assert_equal @swf, t.input end should "fire when declared as a dependency" do t = flashplayer :run => @swf configure_task t other = task :parent => :run other.invoke end end private def configure_task t t.logger = StringIO.new # Comment following lines to really launch the player: sys = FakeSystem.new t.stubs(:current_system).returns sys sys.expects(:open_flashplayer_with) end end class FakeSystem def clean_path path path end def open_flashplayer_with player, swf end end