diff --git a/spec/unit/puppet/provider/network_route/network_route_spec.rb b/spec/unit/puppet/provider/network_route/network_route_spec.rb index cc868d08..22799bce 100644 --- a/spec/unit/puppet/provider/network_route/network_route_spec.rb +++ b/spec/unit/puppet/provider/network_route/network_route_spec.rb @@ -23,12 +23,12 @@ module Puppet::Provider::NetworkRoute; end [ { default_route: true, - ensure: "present", - gateway: "10.0.2.2", - interface: "enp0s3", - metric: "100", - prefix: "default", - protocol: "dhcp" + ensure: 'present', + gateway: '10.0.2.2', + interface: 'enp0s3', + metric: '100', + prefix: 'default', + protocol: 'dhcp' } ] end @@ -40,18 +40,31 @@ module Puppet::Provider::NetworkRoute; end it 'processes resources' do expect(provider.get(context)).to eq( - [{:default_route=>true, - :ensure=>"present", - :gateway=>"10.0.2.2", - :interface=>"enp0s3", - :metric=>"100", - :prefix=>"default", - :protocol=>"dhcp"}] + [{default_route: true, + ensure: 'present', + gateway: '10.0.2.2', + interface: 'enp0s3', + metric: '100', + prefix: 'default', + protocol: 'dhcp'}] ) end end describe '#puppet_munge(should)' do + let(:should) { network_route[0] } + + it 'should parse network_route into iproute2 keys' do + expect(provider.puppet_munge(should)).to eq( + { + dev: 'enp0s3', + metric: '100', + prefix: 'default', + proto: 'dhcp', + via: '10.0.2.2', + } + ) + end end # describe 'create(context, name, should)' do