Sha256: afd4713e34b0fac0581d099f0d927423c428b195007da57cf62e5b1a61271e71
Contents?: true
Size: 1.26 KB
Versions: 6
Compression:
Stored size: 1.26 KB
Contents
require 'test_helper' require 'solusvm/cli' class TestBaseCLI < Test::Unit::TestCase def setup # Prevents mocha from stubbing non existent methods so that we now if the CLI is failing because # something was moved around. Mocha::Configuration.prevent(:stubbing_non_existent_method) @base_cli = SolusVM::BaseCLI.new @api = SolusVM::Base.new @base_cli.stubs(:api).returns(@api) end def test_should_print_multiple_lines_if_enumerable @api.stubs(:successful?).returns(true) @base_cli.expects(:say).with("val1", nil, true) @base_cli.expects(:say).with("val2", nil, true) @base_cli.output(["val1", "val2"]) end def test_should_use_retry_middleware_if_retry_request retry_middleware = Faraday::Request.lookup_middleware :retry @api = SolusVM::Base.new(solusvm_params.merge(retry_request: true)) assert_equal @api.conn.builder[0], retry_middleware @api = SolusVM::Base.new(solusvm_params) assert_not_equal @api.conn.builder[0], retry_middleware end def test_should_print_error_if_not_successful @api.stubs(:successful?).returns(false) @api.stubs(:statusmsg).returns("the message") @base_cli.expects(:say).with("Request failed: the message", nil, true) @base_cli.output("result") end end
Version data entries
6 entries across 6 versions & 1 rubygems