spec/unit/ipaddress6_spec.rb in facter-1.6.18 vs spec/unit/ipaddress6_spec.rb in facter-1.7.0.rc1

- old
+ new

@@ -9,13 +9,16 @@ def netsh_fixture(filename) File.read(fixtures('netsh', filename)) end + describe "IPv6 address fact" do + include FacterSpec::ConfigHelper + before do - Facter::Util::Config.stubs(:is_windows?).returns(false) + given_a_configuration_of(:is_windows => false) end it "should return ipaddress6 information for Darwin" do Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Darwin') Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig") @@ -32,10 +35,19 @@ returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces')) Facter.value(:ipaddress6).should == "2610:10:20:209:212:3fff:febe:2201" end + it "should return ipaddress6 information for Linux with recent net-tools" do + Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Linux') + Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig") + Facter::Util::IP.stubs(:exec_ifconfig).with(["2>/dev/null"]). + returns(ifconfig_fixture('ifconfig_net_tools_1.60.txt')) + + Facter.value(:ipaddress6).should == "2610:10:20:209:212:3fff:febe:2201" + end + it "should return ipaddress6 information for Solaris" do Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS') Facter::Util::IP.stubs(:get_ifconfig).returns("/usr/sbin/ifconfig") Facter::Util::IP.stubs(:exec_ifconfig).with(["-a"]). returns(ifconfig_fixture('sunos_ifconfig_all_with_multiple_interfaces')) @@ -43,10 +55,10 @@ Facter.value(:ipaddress6).should == "2610:10:20:209:203:baff:fe27:a7c" end it "should return ipaddress6 information for Windows" do ENV.stubs(:[]).with('SYSTEMROOT').returns('d:/windows') - Facter::Util::Config.stubs(:is_windows?).returns(true) + given_a_configuration_of(:is_windows => true) fixture = netsh_fixture('windows_netsh_addresses_with_multiple_interfaces') Facter::Util::Resolution.stubs(:exec).with('d:/windows/system32/netsh.exe interface ipv6 show address level=verbose'). returns(fixture)