Sha256: 1a1ae1896e052707c9dbed7cc0f40513cb31a299340a8dcddce77c4987835c8d
Contents?: true
Size: 1.38 KB
Versions: 69
Compression:
Stored size: 1.38 KB
Contents
require File.expand_path("../common", __FILE__) require "gem_publisher/cli_facade" module GemPublisher class CliFacadeTest < MiniTest::Unit::TestCase def test_should_raise_exception_if_command_failed status = stub(:exitstatus => 1) Open3.stubs(:capture3).returns(["stdout", "stderr", status]) assert_raises CliFacade::Error do CliFacade.new.execute("status") end end def test_should_include_all_output_in_error status = stub(:exitstatus => 1) Open3.stubs(:capture3).returns(["stdout", "stderr", status]) err = assert_raises CliFacade::Error do CliFacade.new.execute("status") end assert_equal "stderr\nstdout", err.message Open3.stubs(:capture3).returns(["stdout", "", status]) err = assert_raises CliFacade::Error do CliFacade.new.execute("status") end assert_equal "stdout", err.message end def test_should_return_stdout_if_command_succeeded status = stub(:exitstatus => 0) Open3.stubs(:capture3).returns(["stdout", "stderr", status]) assert_equal "stdout", CliFacade.new.execute("status") end def test_should_escape_and_pass_in_all_commands status = stub(:exitstatus => 0) Open3.expects(:capture3). with("foo bar \\*"). returns(["stdout", "stderr", status]) CliFacade.new.execute("foo", "bar", "*") end end end
Version data entries
69 entries across 65 versions & 18 rubygems