Sha256: 57a2f9c7dcfc613b9723c07241792b1772cd9328fd7e2a1a93853a0ea2d65d32

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 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

5 entries across 5 versions & 1 rubygems

Version Path
vtools-1.0.2 spec/options_spec.rb
vtools-1.0.1 spec/options_spec.rb
vtools-1.0.0 spec/options_spec.rb
vtools-0.1.1 spec/options_spec.rb
vtools-0.1.0 spec/options_spec.rb