test/unit/task_test.rb in flashplayer-10.1.1.pre vs test/unit/task_test.rb in flashplayer-10.1.2.pre

- old
+ new

@@ -4,24 +4,48 @@ 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 "attempt to launch the Flash Player" do - sys = FakeSystem.new + should "work with swf as task name" do + t = flashplayer @swf + configure_task t + t.invoke + end - @task = FlashPlayer::Task.new - @task.logger = StringIO.new + 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 - # Comment following lines to really launch the player: - @task.stubs(:current_system).returns sys - sys.expects(:open_flashplayer_with) - - @task.execute @swf + should "work with swf as prerequisite" do + t = flashplayer :run => @swf + configure_task t + t.invoke + assert_equal @swf, t.input 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