diff options
| author | Daniel Pittman <daniel@rimspace.net> | 2011-01-26 22:48:55 -0800 |
|---|---|---|
| committer | Daniel Pittman <daniel@rimspace.net> | 2011-01-27 17:18:04 -0800 |
| commit | a4fe4598b681b75f5dc66e8193cefbf069cac728 (patch) | |
| tree | 4385bdfddfaca5e5527e4392aa449fbe9bca73ca /spec/unit/util | |
| parent | 0cd6137c11d1a0e1148b603e68a5ebee9d0953d5 (diff) | |
| download | facter-a4fe4598b681b75f5dc66e8193cefbf069cac728.tar.gz facter-a4fe4598b681b75f5dc66e8193cefbf069cac728.tar.xz facter-a4fe4598b681b75f5dc66e8193cefbf069cac728.zip | |
Refactor #6044 -- port testing to rspec2
We have moved to rspec2 for puppet, and facter should follow suit.
Diffstat (limited to 'spec/unit/util')
| -rwxr-xr-x[-rw-r--r--] | spec/unit/util/macaddress.rb | 10 | ||||
| -rwxr-xr-x[-rw-r--r--] | spec/unit/util/uptime.rb | 10 | ||||
| -rw-r--r-- | spec/unit/util/virtual.rb | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | spec/unit/util/xendomains.rb | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/spec/unit/util/macaddress.rb b/spec/unit/util/macaddress.rb index 1ccca18..09794ec 100644..100755 --- a/spec/unit/util/macaddress.rb +++ b/spec/unit/util/macaddress.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'facter/util/macaddress' -context "Darwin" do +describe "Darwin" do test_cases = [ # version, iface, real macaddress, fallback macaddress ["9.8.0", 'en0', "00:17:f2:06:e4:2e", "00:17:f2:06:e4:2e"], @@ -17,12 +17,12 @@ context "Darwin" do ifconfig_file_no_iface = File.join(SPECDIR, "fixtures", "ifconfig", "darwin_#{version.tr('.', '_')}") ifconfig_file = "#{ifconfig_file_no_iface}_#{default_iface}" - context "version #{version}" do + describe "version #{version}" do describe Facter::Util::Macaddress::Darwin do describe ".default_interface" do - context "when netstat has a default interface" do + describe "when netstat has a default interface" do before do Facter::Util::Macaddress::Darwin.stubs(:netstat_command).returns("cat \"#{netstat_file}\"") @@ -36,7 +36,7 @@ context "Darwin" do end describe ".macaddress" do - context "when netstat has a default interface" do + describe "when netstat has a default interface" do before do Facter.stubs(:warn) Facter::Util::Macaddress::Darwin.stubs(:default_interface).returns('') @@ -49,7 +49,7 @@ context "Darwin" do end - context "when netstat does not have a default interface" do + describe "when netstat does not have a default interface" do before do Facter::Util::Macaddress::Darwin.stubs(:default_interface).returns("") Facter::Util::Macaddress::Darwin.stubs(:ifconfig_command).returns("cat \"#{ifconfig_file_no_iface}\"") diff --git a/spec/unit/util/uptime.rb b/spec/unit/util/uptime.rb index b7e3089..c104856 100644..100755 --- a/spec/unit/util/uptime.rb +++ b/spec/unit/util/uptime.rb @@ -7,7 +7,7 @@ require 'facter/util/uptime' describe Facter::Util::Uptime do describe ".get_uptime_seconds_unix" do - context "when /proc/uptime is available" do + describe "when /proc/uptime is available" do before do uptime_file = File.join(SPECDIR, "fixtures", "uptime", "ubuntu_proc_uptime") Facter::Util::Uptime.stubs(:uptime_file).returns("\"#{uptime_file}\"") @@ -19,7 +19,7 @@ describe Facter::Util::Uptime do end - context "when /proc/uptime is not available" do + describe "when /proc/uptime is not available" do before :each do @nonexistent_file = '/non/existent/file' File.exists?(@nonexistent_file).should == false @@ -33,7 +33,7 @@ describe Facter::Util::Uptime do Facter::Util::Uptime.get_uptime_seconds_unix.should == 60 * 60 end - context "nor is 'sysctl kern.boottime'" do + describe "nor is 'sysctl kern.boottime'" do before :each do Facter::Util::Uptime.stubs(:uptime_sysctl_cmd).returns("cat \"#{@nonexistent_file}\"") end @@ -45,7 +45,7 @@ describe Facter::Util::Uptime do Facter::Util::Uptime.get_uptime_seconds_unix.should == 60 * 60 end - context "nor is 'kstat -p unix:::boot_time'" do + describe "nor is 'kstat -p unix:::boot_time'" do before :each do Facter::Util::Uptime.stubs(:uptime_kstat_cmd).returns("cat \"#{@nonexistent_file}\"") end @@ -57,7 +57,7 @@ describe Facter::Util::Uptime do Facter::Util::Uptime.get_uptime_seconds_unix.should == 60 * 60 end - context "nor is 'who -b'" do + describe "nor is 'who -b'" do before :each do Facter::Util::Uptime.stubs(:uptime_who_cmd).returns("cat \"#{@nonexistent_file}\"") end diff --git a/spec/unit/util/virtual.rb b/spec/unit/util/virtual.rb index 72186f7..66dc98c 100644 --- a/spec/unit/util/virtual.rb +++ b/spec/unit/util/virtual.rb @@ -67,7 +67,7 @@ describe Facter::Util::Virtual do ] test_cases.each do |status_file, expected, description| - context "with /proc/self/status from #{description}" do + describe "with /proc/self/status from #{description}" do it "should detect vserver as #{expected.inspect}" do status = File.read(status_file) FileTest.stubs(:exists?).with("/proc/self/status").returns(true) diff --git a/spec/unit/util/xendomains.rb b/spec/unit/util/xendomains.rb index a0fa345..bd9c5d5 100644..100755 --- a/spec/unit/util/xendomains.rb +++ b/spec/unit/util/xendomains.rb @@ -13,7 +13,7 @@ describe Facter::Util::Xendomains do Facter::Util::Xendomains.get_domains.should == %{web01,mailserver} end - context "when xm list isn't executable" do + describe "when xm list isn't executable" do it "should be nil" do Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/xm list').returns(nil) Facter::Util::Xendomains.get_domains.should == nil |
