Sha256: 636f3f8e414796123fce8726aafa723a3685c351e2849ce97b0dc8ea45713474
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true RSpec.describe TTY::Config, '#generate' do it "generate config content" do conf = { 'int' => 1, 'false' => false, 'str' => 'hello', 'array' => [1,2,3], 'deep_array' => [ {foo: 1}, {bar: 2} ], 'section' => { 'value' => 1, 'empty' => nil, 'array' => [1,2,3] }, "empty" => { }, 'nil' => nil, } content = TTY::Config.generate(conf) expect(content).to eq <<-EOS array = 1,2,3 false = false int = 1 str = hello [deep_array] foo = 1 bar = 2 [section] value = 1 array = 1,2,3 EOS end it "generate config content with custom separator" do conf = { 'str' => 'hello', 'array' => [1,2,3], 'deep_array' => [ {foo: 1}, {bar: 2} ], 'section' => { 'value' => 1, 'array' => [1,2,3] } } content = TTY::Config.generate(conf, separator: ':') expect(content).to eq <<-EOS array : 1,2,3 str : hello [deep_array] foo : 1 bar : 2 [section] value : 1 array : 1,2,3 EOS end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tty-config-0.3.2 | spec/unit/generate_spec.rb |
tty-config-0.3.1 | spec/unit/generate_spec.rb |
tty-config-0.3.0 | spec/unit/generate_spec.rb |