Sha256: b574b5d8cd8ac7f00d70b823e03903cfdde6e9d615e1f4124fb6de9a0b83794f
Contents?: true
Size: 591 Bytes
Versions: 5
Compression:
Stored size: 591 Bytes
Contents
require 'samovar' require 'stringio' module Command class Coerce < Samovar::Command options do option '--things <array>', "A list of things" do |input| input.split(/\s*,\s*/) end option '--count <integer>', "A number to count", type: Integer end end end describe Samovar::Command do it "should coerce to array" do top = Command::Coerce.parse(['--things', 'a,b,c']) expect(top.options[:things]).to be == ['a', 'b', 'c'] end it "should coerce to integer" do top = Command::Coerce.parse(['--count', '10']) expect(top.options[:count]).to be == 10 end end
Version data entries
5 entries across 5 versions & 1 rubygems