Sha256: 327fda44159b1fd1eac776b9d1a577fbfdc1131f4b5c8b7366218804a09c42fb
Contents?: true
Size: 984 Bytes
Versions: 3
Compression:
Stored size: 984 Bytes
Contents
require 'spec_helper' require 'xway/cli' require 'xway/version' describe Xway::Cli do let('parameter') do double('Xway::Parameter').tap do |mock| mock.stub('rest').and_return([]) mock.stub('[]').with(:version).and_return(nil) end end let('api') { double('api') } let('out') { double('stdout').tap { |o| o.stub('puts') } } before { Xway.stub('parameter').and_return(parameter) } subject { described_class.new api, out } it 'prints usage per default' do parameter.should_receive('print_help!') subject.start end it 'prints version on :version parameter' do parameter.stub('[]').with(:version).and_return(true) out.should_receive('puts').with("xway #{Xway::VERSION}") subject.start end it 'executes commands on api' do api.should_receive('request').with('list').and_return('list result') out.should_receive('puts').with('list result') parameter.stub('rest').and_return(['list']) subject.start end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xway-0.0.3.beta | spec/lib/xway/cli_spec.rb |
xway-0.0.2.beta | spec/lib/xway/cli_spec.rb |
xway-0.0.1.beta | spec/lib/xway/cli_spec.rb |