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 039f825
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions spec/unit/puppet/provider/network_route/network_route_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,50 @@ 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

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 '#get' do
before(:each) do
allow(provider).to receive(:routes_list).and_return(route) # rubocop:disable RSpec/SubjectStub
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
end

# describe 'create(context, name, should)' do
# it 'creates the resource' do
# expect(context).to receive(:notice).with(%r{\ACreating 'a'})
Expand Down

0 comments on commit 039f825

Please sign in to comment.