Sha256: 2cc5ee91796bc30f5f01dbe785221e0546199beba701f60bc74cc3b2c3d654a3
Contents?: true
Size: 769 Bytes
Versions: 2
Compression:
Stored size: 769 Bytes
Contents
RSpec.describe Samovar::Options do subject(:options) do described_class.parse do option '-x <value>', "The x factor", default: 2 option '-y <value>', "The y factor" option '--symbol <value>', "A symbol", type: Symbol end end it "should set defaults" do values = options.parse([], nil) expect(values).to be == {x: 2} end it "should preserve current values" do values = options.parse([], {x: 1, y: 2, z: 3}) expect(values).to be == {x: 1, y: 2, z: 3} end it "should update specified values" do values = options.parse(['-x', 10], {x: 1, y: 2, z: 3}) expect(values).to be == {x: 10, y: 2, z: 3} end it "converts to symbol" do values = options.parse(['--symbol', 'thing'], {}) expect(values[:symbol]).to eq :thing end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
samovar-1.10.0 | spec/samovar/options_spec.rb |
samovar-1.9.2 | spec/samovar/options_spec.rb |