Sha256: 80e2ad7ff446f46db6509f4eb91a2dbf397512650b0d5cfbb29f409b4eff6097

Contents?: true

Size: 673 Bytes

Versions: 202

Compression:

Stored size: 673 Bytes

Contents

require 'spec_helper'
require 'thor/parser'

describe Thor::Options do
  def create(opts, defaults={})
    opts.each do |key, value|
      opts[key] = Thor::Option.parse(key, value) unless value.is_a?(Thor::Option)
    end
    @opt = Thor::Options.new(opts, defaults)
  end

  def parse(*args)
    @opt.parse(args.flatten)
  end

  describe "#parse" do
    describe "with :array type" do
      it "accepts a switch=<value> assignment, where value is a set of paramters split by comma or spaces" do
        create "--attributes" => :array
        parse("--attributes=a,b", "c, d", "e ,  f")["attributes"].should == ["a", "b", "c", "d", "e", "f"]
      end
    end
  end
end

Version data entries

202 entries across 202 versions & 1 rubygems

Version Path
shelly-0.5.7 spec/thor/options_spec.rb
shelly-0.5.6 spec/thor/options_spec.rb
shelly-0.5.5 spec/thor/options_spec.rb
shelly-0.5.4 spec/thor/options_spec.rb
shelly-0.5.3 spec/thor/options_spec.rb
shelly-0.5.2 spec/thor/options_spec.rb
shelly-0.5.1 spec/thor/options_spec.rb
shelly-0.5.0 spec/thor/options_spec.rb
shelly-0.4.42 spec/thor/options_spec.rb
shelly-0.4.41 spec/thor/options_spec.rb
shelly-0.4.40 spec/thor/options_spec.rb
shelly-0.4.39 spec/thor/options_spec.rb
shelly-0.4.38 spec/thor/options_spec.rb
shelly-0.4.37 spec/thor/options_spec.rb
shelly-0.4.36 spec/thor/options_spec.rb
shelly-0.4.35 spec/thor/options_spec.rb
shelly-0.4.34 spec/thor/options_spec.rb
shelly-0.4.33 spec/thor/options_spec.rb
shelly-0.4.32 spec/thor/options_spec.rb
shelly-0.4.31 spec/thor/options_spec.rb