Skip to content

Commit

Permalink
Add puppet_munge test to provider tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhollinger committed Aug 15, 2018
1 parent 68845cc commit 1427fee
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions spec/unit/puppet/provider/network_route/network_route_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1427fee

Please sign in to comment.