Sha256: 6bc67edc04247238f2676c27d4c25a5bd4a2510f15f85c8a97cc734adb64d24b

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe VagrantShellCommander::OptionManager do
  let(:subject) {described_class.new}
  let(:argv) {double()}

  describe '#execute' do
    let(:option_parser) {double(:banner= => true, 
                                separator: true, 
                                on: true)}

    before(:each) do
      OptionParser.stub(:new).
        and_yield(option_parser)
      
      subject.stub(:parse_options).and_return(true)
    end
    
    after(:each) do

    end
      
    it 'displays a informing banner' do
      option_parser.should_receive(:banner=)

      subject.execute
    end
    
    it 'has a dir option' do
      dir_value = 'dir'
      
      option_parser.stub(:on).with('-d [DIR]', 
                                   anything, 
                                   anything).
        and_yield(dir_value)

      result = subject.execute

      expect(result[:values][:dir]).to eql(dir_value)
    end
    
    it 'has a cmd option' do
      cmd_value = 'cmd'
      
      option_parser.stub(:on).with("-c 'COMMAND'", 
                                   anything, 
                                   anything).
        and_yield(cmd_value)

      result = subject.execute

      expect(result[:values][:cmd]).to eql(cmd_value)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-shell-commander-0.1.4 spec/option_manager_spec.rb
vagrant-shell-commander-0.1.3 spec/option_manager_spec.rb