diff options
author | kaustubh-d <kausubh@clogeny.com> | 2013-07-18 02:13:35 -0700 |
---|---|---|
committer | adamedx <adamed@opscode.com> | 2013-07-23 10:36:15 -0700 |
commit | 18f4c43028f5ef51831488668c4227a2fd128a7c (patch) | |
tree | 38ccb0e2ed1287cf9082dfb5e1be9ab7e0e946f2 | |
parent | 81e80f1edc9b117246a0506c3fa1b7c25b92d0bc (diff) | |
download | chef-18f4c43028f5ef51831488668c4227a2fd128a7c.tar.gz |
aix ifconfig - delete unit tests.
-rw-r--r-- | spec/unit/provider/ifconfig/aix_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb index c9dd771052..0408d00388 100644 --- a/spec/unit/provider/ifconfig/aix_spec.rb +++ b/spec/unit/provider/ifconfig/aix_spec.rb @@ -200,4 +200,48 @@ IFCONFIG end end + describe "#action_delete" do + + it "should not delete an interface if it does not exist" do + @new_resource.device "en10" + @provider.stub!(:load_current_resource) do + @provider.instance_variable_set("@status", double("Status", :exitstatus => 0)) + @provider.instance_variable_set("@current_resource", Chef::Resource::Ifconfig.new("10.0.0.1", @run_context)) + end + + @provider.should_not_receive(:run_command) + + @provider.run_action(:delete) + @new_resource.should_not be_updated + end + + context "interface exists" do + before do + @new_resource.device "en10" + @provider.stub!(:load_current_resource) do + @provider.instance_variable_set("@status", double("Status", :exitstatus => 0)) + current_resource = Chef::Resource::Ifconfig.new("10.0.0.1", @run_context) + current_resource.device @new_resource.device + @provider.instance_variable_set("@current_resource", current_resource) + end + end + + it "should delete an interface if it exists" do + command = "chdev -l #{@new_resource.device} -a state=down" + @provider.should_receive(:run_command).with(:command => command) + + @provider.run_action(:delete) + @new_resource.should be_updated + end + + it "should delete a VIP if it exists" do + @new_resource.is_vip true + command = "chdev -l #{@new_resource.device} -a delalias4=#{@new_resource.name}" + @provider.should_receive(:run_command).with(:command => command) + + @provider.run_action(:delete) + @new_resource.should be_updated + end + end + end end
\ No newline at end of file |