summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-29 12:22:47 -0700
committerTim Smith <tsmith@chef.io>2018-10-29 12:22:47 -0700
commitb26dbf802daa488e14232a5a88bc49d23a4a64f7 (patch)
tree67d0108a6b0d18ca50ef88314bc886117837d53b
parenta71493d575cb24fce33faf26e2530cdc45bcafe2 (diff)
downloadchef-b26dbf802daa488e14232a5a88bc49d23a4a64f7.tar.gz
Fix support for passing route type as a Stringroute_resource
Add a test for this as well so we don't break it again later. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/route.rb2
-rw-r--r--spec/unit/resource/route_spec.rb9
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb
index ee91ee2bc7..45a1266fd7 100644
--- a/lib/chef/resource/route.rb
+++ b/lib/chef/resource/route.rb
@@ -48,7 +48,7 @@ class Chef
description: "The network interface to which the route applies.",
desired_state: false # Has a partial default in the provider of eth0.
- property :route_type, Symbol,
+ property :route_type, [Symbol, String],
description: "",
equal_to: [:host, :net], default: :host, desired_state: false
end
diff --git a/spec/unit/resource/route_spec.rb b/spec/unit/resource/route_spec.rb
index d4248755b5..dd79d04024 100644
--- a/spec/unit/resource/route_spec.rb
+++ b/spec/unit/resource/route_spec.rb
@@ -56,8 +56,13 @@ describe Chef::Resource::Route do
expect(resource.device).to eql("eth0")
end
- it "allows you to specify the route type" do
- resource.route_type "host"
+ it "allows you to specify the route type as a symbol" do
+ resource.route_type :host
+ expect(resource.route_type).to eql(:host)
+ end
+
+ it "allows you to specify the route type as a string" do
+ resource.route_type :host
expect(resource.route_type).to eql(:host)
end