diff options
author | Tom Doherty <tom.doherty@fixnetix.com> | 2017-09-08 16:17:45 +0100 |
---|---|---|
committer | Tom Doherty <tom.doherty@fixnetix.com> | 2017-09-08 16:17:45 +0100 |
commit | d78b719df2a6ef127f7becb9b7b7be25a4260560 (patch) | |
tree | b29c94d1fbc1877e5bb763158d55b947a2605a0c /spec | |
parent | b8ebe375fae24a35deac44b62a020fba6890b506 (diff) | |
download | chef-d78b719df2a6ef127f7becb9b7b7be25a4260560.tar.gz |
Simplify and add unit test for default route
Signed-off-by: Tom Doherty <tom.doherty@fixnetix.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/route_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb index 2beb765259..a9c7d91457 100644 --- a/spec/unit/provider/route_spec.rb +++ b/spec/unit/provider/route_spec.rb @@ -29,9 +29,14 @@ describe Chef::Provider::Route do @new_resource.gateway "10.0.0.9" @current_resource = Chef::Resource::Route.new("10.0.0.10") @current_resource.gateway "10.0.0.9" + @default_resource = Chef::Resource::Route.new("default") + @default_resource.gateway "10.0.0.9" @provider = Chef::Provider::Route.new(@new_resource, @run_context) @provider.current_resource = @current_resource + + @default_provider = Chef::Provider::Route.new(@default_resource, @run_context) + @default_provider.current_resource = @default_resource end describe Chef::Provider::Route, "hex2ip" do @@ -161,6 +166,11 @@ describe Chef::Provider::Route do @new_resource.gateway(nil) expect(@provider.generate_command(:add).join(" ")).not_to match(/\svia\s#{Regexp.escape(@new_resource.gateway.to_s)}/) end + + it "should use the gatway when target is default" do + @default_resource.gateway("10.0.0.10") + expect(@default_provider.generate_command(:add).join(" ")).to match(/10.0.0.10/) + end end describe Chef::Provider::Route, "generate_command for action_delete" do |