Sha256: be4de0b713cfe5c67d8f696780a49284b581e1fdce70304cd8936811988da582
Contents?: true
Size: 586 Bytes
Versions: 7
Compression:
Stored size: 586 Bytes
Contents
require 'samovar' require 'stringio' module Samovar::CoerceSpec 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 RSpec.describe Samovar::Command do it "should coerce to array" do top = Coerce['--things', 'a,b,c'] expect(top.options[:things]).to be == ['a', 'b', 'c'] end it "should coerce to integer" do top = Coerce['--count', '10'] expect(top.options[:count]).to be == 10 end end end
Version data entries
7 entries across 7 versions & 1 rubygems