Sha256: 3b2e183ce7d0c0ce01cf46c6b63f8a0e62de4c5431c05854d27a99deefa92359

Contents?: true

Size: 1000 Bytes

Versions: 3

Compression:

Stored size: 1000 Bytes

Contents

require "spec_helper"
require "options"

describe VTools::Options do

  # hooks
  before :all do
    
  end

  # around to test inside the methods

  before do
    
  end

  after do
    
  end

  after :all do
    
  end

  # specs
  context "#parse!" do

    it "creates valid options" do
      opts =    ["server_commnad", "-option_one", "--", "-app_option", "-app_option_two",]
      opts_v =  opts.dup << "-v"
      opts_h =  opts_v.dup << "-h"

      @test = nil
      OptionParser.stub!(:new).and_return nil

      VTools::Options.stub!(:argv=).and_return do |arr|
        arr.should_not include ["server_commnad", "-option_one", "--"]
        arr.should include ["-app_option", "-app_option_two"]
      end

      VTools::Options.parse! opts

      VTools::Options.stub!(:argv=).and_return { |arr| arr.should == ["-v"] }
      VTools::Options.parse! opts_v

      VTools::Options.stub!(:argv=).and_return { |arr| arr.should == ["-h"] }
      VTools::Options.parse! opts_h
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vtools-0.0.3 spec/options_spec.rb
vtools-0.0.2 spec/options_spec.rb
vtools-0.0.1 spec/options_spec.rb