spec/unit/provider/route_spec.rb in chef-10.34.6 vs spec/unit/provider/route_spec.rb in chef-11.0.0.beta.0
- old
+ new
@@ -49,11 +49,11 @@
describe Chef::Provider::Route, "load_current_resource" do
context "on linux" do
before do
- @node[:os] = 'linux'
+ @node.automatic_attrs[:os] = 'linux'
routing_table = "Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT\n" +
"eth0 0064A8C0 0984A8C0 0003 0 0 0 00FFFFFF 0 0 0\n"
route_file = StringIO.new(routing_table)
File.stub!(:open).with("/proc/net/route", "r").and_return(route_file)
end
@@ -196,21 +196,22 @@
end
describe Chef::Provider::Route, "generate_config method" do
%w[ centos redhat fedora ].each do |platform|
it "should write a route file on #{platform} platform" do
- @node[:platform] = platform
+ @node.automatic_attrs[:platform] = platform
route_file = StringIO.new
File.should_receive(:new).with("/etc/sysconfig/network-scripts/route-eth0", "w").and_return(route_file)
#Chef::Log.should_receive(:debug).with("route[10.0.0.10] writing route.eth0\n10.0.0.10 via 10.0.0.9\n")
@run_context.resource_collection << @new_resource
@provider.generate_config
end
end
it "should put all routes for a device in a route config file" do
- @node[:platform] = 'centos'
+ @node.automatic_attrs[:platform] = 'centos'
+
route_file = StringIO.new
File.should_receive(:new).and_return(route_file)
@run_context.resource_collection << Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1')
@run_context.resource_collection << Chef::Resource::Route.new('192.168.2.0/24 via 192.168.0.1')
@run_context.resource_collection << Chef::Resource::Route.new('192.168.3.0/24 via 192.168.0.1')