spec/figtree/transformer_spec.rb in figtree-1.2.0 vs spec/figtree/transformer_spec.rb in figtree-2.0.0

- old
+ new

@@ -10,12 +10,16 @@ Parser.new.parse("[http]\nparams = array,of,values\n") end let(:bool_tree) do Parser.new.parse("[ftp]\nenabled = no\n") end + let(:string_tree) do + Parser.new.parse_with_debug("[database]\nserver = is here\n") + Parser.new.parse("[database]\nserver = is here\n") + end let(:ip_tree) do - Parser.new.parse("[database]\nserver=192.0.2.62") + Parser.new.parse("[database]\nserver = 192.0.2.62") end it 'can apply an int type conversion' do expect(Transformer.new.apply(int_tree)).to eq( [ { @@ -40,10 +44,19 @@ ftp: Subgroup.new(enabled: false) } ] ) end + it 'it can apply a string type conversion' do + expect(Transformer.new.apply(string_tree)).to eq( + [ + { + database: Subgroup.new(server: "is here") + } + ] + ) + end it 'it can apply an ip address type conversion' do expect(Transformer.new.apply(ip_tree)).to eq( [ { database: Subgroup.new(server: IPAddr.new("192.0.2.62")) @@ -58,10 +71,10 @@ end it 'can apply an override' do expect(Transformer.new.apply(override_tree, override: :production)).to eq( [ { - http: Subgroup.new(path: '/srv/var/tmp/') + http: Subgroup.new(path: Pathname.new('/srv/var/tmp/')) } ] ) end end