ohai 7.6.0.rc.1 → 8.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ohai/version.rb +1 -1
  3. data/spec/functional/plugins/powershell_spec.rb +4 -4
  4. data/spec/functional/plugins/root_group_spec.rb +1 -1
  5. data/spec/ohai_spec.rb +1 -1
  6. data/spec/spec_helper.rb +12 -12
  7. data/spec/unit/dsl/plugin_spec.rb +40 -40
  8. data/spec/unit/hints_spec.rb +3 -3
  9. data/spec/unit/loader_spec.rb +16 -16
  10. data/spec/unit/mixin/cloudstack_metadata_spec.rb +1 -1
  11. data/spec/unit/mixin/command_spec.rb +6 -6
  12. data/spec/unit/mixin/ec2_metadata_spec.rb +8 -8
  13. data/spec/unit/plugins/aix/cpu_spec.rb +15 -15
  14. data/spec/unit/plugins/aix/filesystem_spec.rb +15 -15
  15. data/spec/unit/plugins/aix/hostname_spec.rb +3 -3
  16. data/spec/unit/plugins/aix/kernel_spec.rb +14 -14
  17. data/spec/unit/plugins/aix/network_spec.rb +43 -43
  18. data/spec/unit/plugins/aix/platform_spec.rb +5 -5
  19. data/spec/unit/plugins/aix/uptime_spec.rb +7 -7
  20. data/spec/unit/plugins/aix/virtualization_spec.rb +3 -3
  21. data/spec/unit/plugins/azure_spec.rb +18 -18
  22. data/spec/unit/plugins/c_spec.rb +52 -52
  23. data/spec/unit/plugins/chef_spec.rb +1 -1
  24. data/spec/unit/plugins/cloud_spec.rb +31 -31
  25. data/spec/unit/plugins/cloud_v2_spec.rb +33 -33
  26. data/spec/unit/plugins/cloudstack_spec.rb +6 -6
  27. data/spec/unit/plugins/darwin/cpu_spec.rb +19 -19
  28. data/spec/unit/plugins/darwin/hostname_spec.rb +6 -6
  29. data/spec/unit/plugins/darwin/kernel_spec.rb +14 -14
  30. data/spec/unit/plugins/darwin/memory_spec.rb +7 -7
  31. data/spec/unit/plugins/darwin/network_spec.rb +358 -358
  32. data/spec/unit/plugins/darwin/platform_spec.rb +10 -10
  33. data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
  34. data/spec/unit/plugins/dmi_spec.rb +3 -3
  35. data/spec/unit/plugins/ec2_spec.rb +80 -80
  36. data/spec/unit/plugins/erlang_spec.rb +7 -7
  37. data/spec/unit/plugins/eucalyptus_spec.rb +28 -28
  38. data/spec/unit/plugins/fail_spec.rb +8 -8
  39. data/spec/unit/plugins/freebsd/cpu_spec.rb +10 -10
  40. data/spec/unit/plugins/freebsd/hostname_spec.rb +4 -4
  41. data/spec/unit/plugins/freebsd/kernel_spec.rb +6 -6
  42. data/spec/unit/plugins/freebsd/os_spec.rb +3 -3
  43. data/spec/unit/plugins/freebsd/platform_spec.rb +5 -5
  44. data/spec/unit/plugins/freebsd/virtualization_spec.rb +20 -20
  45. data/spec/unit/plugins/gce_spec.rb +18 -18
  46. data/spec/unit/plugins/go_spec.rb +5 -5
  47. data/spec/unit/plugins/groovy_spec.rb +5 -5
  48. data/spec/unit/plugins/hostname_spec.rb +24 -24
  49. data/spec/unit/plugins/init_package_spec.rb +5 -5
  50. data/spec/unit/plugins/ip_scopes_spec.rb +1 -1
  51. data/spec/unit/plugins/java_spec.rb +23 -23
  52. data/spec/unit/plugins/joyent_spec.rb +13 -13
  53. data/spec/unit/plugins/kernel_spec.rb +20 -20
  54. data/spec/unit/plugins/linode_spec.rb +18 -18
  55. data/spec/unit/plugins/linux/cpu_spec.rb +25 -25
  56. data/spec/unit/plugins/linux/filesystem_spec.rb +61 -60
  57. data/spec/unit/plugins/linux/hostname_spec.rb +7 -7
  58. data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
  59. data/spec/unit/plugins/linux/lsb_spec.rb +23 -23
  60. data/spec/unit/plugins/linux/mdadm_spec.rb +11 -11
  61. data/spec/unit/plugins/linux/platform_spec.rb +167 -167
  62. data/spec/unit/plugins/linux/uptime_spec.rb +6 -6
  63. data/spec/unit/plugins/linux/virtualization_spec.rb +156 -156
  64. data/spec/unit/plugins/lua_spec.rb +5 -5
  65. data/spec/unit/plugins/mono_spec.rb +5 -5
  66. data/spec/unit/plugins/netbsd/hostname_spec.rb +6 -6
  67. data/spec/unit/plugins/netbsd/kernel_spec.rb +6 -6
  68. data/spec/unit/plugins/netbsd/platform_spec.rb +5 -5
  69. data/spec/unit/plugins/network_spec.rb +116 -116
  70. data/spec/unit/plugins/nodejs_spec.rb +5 -5
  71. data/spec/unit/plugins/ohai_spec.rb +1 -1
  72. data/spec/unit/plugins/ohai_time_spec.rb +5 -5
  73. data/spec/unit/plugins/openbsd/hostname_spec.rb +6 -6
  74. data/spec/unit/plugins/openbsd/kernel_spec.rb +6 -6
  75. data/spec/unit/plugins/openbsd/platform_spec.rb +4 -4
  76. data/spec/unit/plugins/openstack_spec.rb +8 -8
  77. data/spec/unit/plugins/os_spec.rb +5 -5
  78. data/spec/unit/plugins/passwd_spec.rb +13 -13
  79. data/spec/unit/plugins/perl_spec.rb +8 -8
  80. data/spec/unit/plugins/php_spec.rb +7 -7
  81. data/spec/unit/plugins/platform_spec.rb +9 -9
  82. data/spec/unit/plugins/powershell_spec.rb +10 -10
  83. data/spec/unit/plugins/rackspace_spec.rb +72 -70
  84. data/spec/unit/plugins/root_group_spec.rb +14 -14
  85. data/spec/unit/plugins/ruby_spec.rb +1 -1
  86. data/spec/unit/plugins/sigar/network_route_spec.rb +17 -17
  87. data/spec/unit/plugins/solaris2/cpu_spec.rb +18 -18
  88. data/spec/unit/plugins/solaris2/hostname_spec.rb +4 -4
  89. data/spec/unit/plugins/solaris2/kernel_spec.rb +8 -8
  90. data/spec/unit/plugins/solaris2/memory_spec.rb +3 -3
  91. data/spec/unit/plugins/solaris2/network_spec.rb +13 -13
  92. data/spec/unit/plugins/solaris2/platform_spec.rb +14 -14
  93. data/spec/unit/plugins/solaris2/virtualization_spec.rb +24 -24
  94. data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
  95. data/spec/unit/plugins/ssh_host_keys_spec.rb +18 -18
  96. data/spec/unit/runner_spec.rb +26 -26
  97. data/spec/unit/system_spec.rb +54 -54
  98. data/spec/unit/util/file_helper_spec.rb +2 -2
  99. metadata +50 -95
@@ -22,10 +22,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
  describe Ohai::System, "Linux hostname plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("hostname")
25
- @plugin.stub(:collect_os).and_return(:linux)
26
- @plugin.stub(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
27
- @plugin.stub(:shell_out).with("hostname --fqdn").and_return(mock_shell_out(0, "katie.bethell", ""))
28
- @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
25
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
26
+ allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
27
+ allow(@plugin).to receive(:shell_out).with("hostname --fqdn").and_return(mock_shell_out(0, "katie.bethell", ""))
28
+ allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
29
29
  end
30
30
 
31
31
  it_should_check_from("linux::hostname", "hostname", "hostname -s", "katie")
@@ -36,16 +36,16 @@ describe Ohai::System, "Linux hostname plugin" do
36
36
 
37
37
  describe "when domain name is unset" do
38
38
  before(:each) do
39
- @plugin.should_receive(:shell_out).with("hostname --fqdn").and_raise("Ohai::Exception::Exec")
39
+ expect(@plugin).to receive(:shell_out).with("hostname --fqdn").and_raise("Ohai::Exception::Exec")
40
40
  end
41
41
 
42
42
  it "should not raise an error" do
43
- lambda { @plugin.run }.should_not raise_error
43
+ expect { @plugin.run }.not_to raise_error
44
44
  end
45
45
 
46
46
  it "should not set fqdn" do
47
47
  @plugin.run
48
- @plugin.fqdn.should == nil
48
+ expect(@plugin.fqdn).to eq(nil)
49
49
  end
50
50
 
51
51
  end
@@ -32,11 +32,11 @@ virtio_balloon 13168 0
32
32
  floppy 55441 0
33
33
  ENV_LSMOD
34
34
  @plugin = get_plugin("kernel")
35
- @plugin.stub(:collect_os).and_return(:linux)
36
- @plugin.stub(:init_kernel).and_return({})
37
- @plugin.stub(:shell_out).with("uname -o").and_return(mock_shell_out(0, "Linux", ""))
38
- @plugin.stub(:shell_out).with("env lsmod").and_return(mock_shell_out(0, @env_lsmod, ""))
39
- @plugin.should_receive(:shell_out).with("env lsmod").at_least(1).times
35
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
36
+ allow(@plugin).to receive(:init_kernel).and_return({})
37
+ allow(@plugin).to receive(:shell_out).with("uname -o").and_return(mock_shell_out(0, "Linux", ""))
38
+ allow(@plugin).to receive(:shell_out).with("env lsmod").and_return(mock_shell_out(0, @env_lsmod, ""))
39
+ expect(@plugin).to receive(:shell_out).with("env lsmod").at_least(1).times
40
40
  @plugin.run
41
41
  end
42
42
 
@@ -24,46 +24,46 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
24
24
  describe Ohai::System, "Linux lsb plugin" do
25
25
  before(:each) do
26
26
  @plugin = get_plugin("linux/lsb")
27
- @plugin.stub(:collect_os).and_return(:linux)
27
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
28
28
  end
29
29
 
30
30
  describe "on systems with /etc/lsb-release" do
31
31
  before(:each) do
32
32
  @double_file = double("/etc/lsb-release")
33
- @double_file.stub(:each).
33
+ allow(@double_file).to receive(:each).
34
34
  and_yield("DISTRIB_ID=Ubuntu").
35
35
  and_yield("DISTRIB_RELEASE=8.04").
36
36
  and_yield("DISTRIB_CODENAME=hardy").
37
37
  and_yield('DISTRIB_DESCRIPTION="Ubuntu 8.04"')
38
- File.stub(:open).with("/etc/lsb-release").and_return(@double_file)
39
- File.stub(:exists?).with("/etc/lsb-release").and_return(true)
38
+ allow(File).to receive(:open).with("/etc/lsb-release").and_return(@double_file)
39
+ allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(true)
40
40
  end
41
41
 
42
42
  it "should set lsb[:id]" do
43
43
  @plugin.run
44
- @plugin[:lsb][:id].should == "Ubuntu"
44
+ expect(@plugin[:lsb][:id]).to eq("Ubuntu")
45
45
  end
46
46
 
47
47
  it "should set lsb[:release]" do
48
48
  @plugin.run
49
- @plugin[:lsb][:release].should == "8.04"
49
+ expect(@plugin[:lsb][:release]).to eq("8.04")
50
50
  end
51
51
 
52
52
  it "should set lsb[:codename]" do
53
53
  @plugin.run
54
- @plugin[:lsb][:codename].should == "hardy"
54
+ expect(@plugin[:lsb][:codename]).to eq("hardy")
55
55
  end
56
56
 
57
57
  it "should set lsb[:description]" do
58
58
  @plugin.run
59
- @plugin[:lsb][:description].should == "Ubuntu 8.04"
59
+ expect(@plugin[:lsb][:description]).to eq("Ubuntu 8.04")
60
60
  end
61
61
  end
62
62
 
63
63
  describe "on systems with /usr/bin/lsb_release" do
64
64
  before(:each) do
65
- File.stub(:exists?).with("/etc/lsb-release").and_return(false)
66
- File.stub(:exists?).with("/usr/bin/lsb_release").and_return(true)
65
+ allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(false)
66
+ allow(File).to receive(:exists?).with("/usr/bin/lsb_release").and_return(true)
67
67
 
68
68
  @stdin = double("STDIN", { :close => true })
69
69
  @pid = 10
@@ -82,27 +82,27 @@ Description: CentOS release 5.4 (Final)
82
82
  Release: 5.4
83
83
  Codename: Final
84
84
  LSB_RELEASE
85
- @plugin.stub(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
85
+ allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
86
86
  end
87
87
 
88
88
  it "should set lsb[:id]" do
89
89
  @plugin.run
90
- @plugin[:lsb][:id].should == "CentOS"
90
+ expect(@plugin[:lsb][:id]).to eq("CentOS")
91
91
  end
92
92
 
93
93
  it "should set lsb[:release]" do
94
94
  @plugin.run
95
- @plugin[:lsb][:release].should == "5.4"
95
+ expect(@plugin[:lsb][:release]).to eq("5.4")
96
96
  end
97
97
 
98
98
  it "should set lsb[:codename]" do
99
99
  @plugin.run
100
- @plugin[:lsb][:codename].should == "Final"
100
+ expect(@plugin[:lsb][:codename]).to eq("Final")
101
101
  end
102
102
 
103
103
  it "should set lsb[:description]" do
104
104
  @plugin.run
105
- @plugin[:lsb][:description].should == "CentOS release 5.4 (Final)"
105
+ expect(@plugin[:lsb][:description]).to eq("CentOS release 5.4 (Final)")
106
106
  end
107
107
  end
108
108
 
@@ -115,34 +115,34 @@ Description: Fedora release 14 (Laughlin)
115
115
  Release: 14
116
116
  Codename: Laughlin
117
117
  LSB_RELEASE
118
- @plugin.stub(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
118
+ allow(@plugin).to receive(:shell_out).with("lsb_release -a").and_return(mock_shell_out(0, @stdout, ""))
119
119
  end
120
120
 
121
121
  it "should set lsb[:id]" do
122
122
  @plugin.run
123
- @plugin[:lsb][:id].should == "Fedora"
123
+ expect(@plugin[:lsb][:id]).to eq("Fedora")
124
124
  end
125
125
 
126
126
  it "should set lsb[:release]" do
127
127
  @plugin.run
128
- @plugin[:lsb][:release].should == "14"
128
+ expect(@plugin[:lsb][:release]).to eq("14")
129
129
  end
130
130
 
131
131
  it "should set lsb[:codename]" do
132
132
  @plugin.run
133
- @plugin[:lsb][:codename].should == "Laughlin"
133
+ expect(@plugin[:lsb][:codename]).to eq("Laughlin")
134
134
  end
135
135
 
136
136
  it "should set lsb[:description]" do
137
137
  @plugin.run
138
- @plugin[:lsb][:description].should == "Fedora release 14 (Laughlin)"
138
+ expect(@plugin[:lsb][:description]).to eq("Fedora release 14 (Laughlin)")
139
139
  end
140
140
  end
141
141
  end
142
142
 
143
143
  it "should not set any lsb values if /etc/lsb-release or /usr/bin/lsb_release do not exist " do
144
- File.stub(:exists?).with("/etc/lsb-release").and_return(false)
145
- File.stub(:exists?).with("/usr/bin/lsb_release").and_return(false)
146
- @plugin.attribute?(:lsb).should be(false)
144
+ allow(File).to receive(:exists?).with("/etc/lsb-release").and_return(false)
145
+ allow(File).to receive(:exists?).with("/usr/bin/lsb_release").and_return(false)
146
+ expect(@plugin.attribute?(:lsb)).to be(false)
147
147
  end
148
148
  end
@@ -54,48 +54,48 @@ Working Devices : 6
54
54
  5 8 112 5 active sync /dev/sdh
55
55
  MD
56
56
  @plugin = get_plugin("linux/mdadm")
57
- @plugin.stub(:collect_os).and_return(:linux)
57
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
58
58
  @double_file = double("/proc/mdstat")
59
- @double_file.stub(:each).
59
+ allow(@double_file).to receive(:each).
60
60
  and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]").
61
61
  and_yield("md0 : active raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]").
62
62
  and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
63
- File.stub(:open).with("/proc/mdstat").and_return(@double_file)
64
- File.stub(:exist?).with("/proc/mdstat").and_return(true)
65
- @plugin.stub(:shell_out).with("mdadm --detail /dev/md0").and_return(mock_shell_out(0, @md0, ""))
63
+ allow(File).to receive(:open).with("/proc/mdstat").and_return(@double_file)
64
+ allow(File).to receive(:exist?).with("/proc/mdstat").and_return(true)
65
+ allow(@plugin).to receive(:shell_out).with("mdadm --detail /dev/md0").and_return(mock_shell_out(0, @md0, ""))
66
66
  end
67
67
 
68
68
  describe "gathering Mdadm information via /proc/mdstat and mdadm" do
69
69
 
70
70
  it "should not raise an error" do
71
- lambda { @plugin.run }.should_not raise_error
71
+ expect { @plugin.run }.not_to raise_error
72
72
  end
73
73
 
74
74
  it "should detect raid level" do
75
75
  @plugin.run
76
- @plugin[:mdadm][:md0][:level].should == 10
76
+ expect(@plugin[:mdadm][:md0][:level]).to eq(10)
77
77
  end
78
78
 
79
79
  it "should detect raid state" do
80
80
  @plugin.run
81
- @plugin[:mdadm][:md0][:state].should == "clean"
81
+ expect(@plugin[:mdadm][:md0][:state]).to eq("clean")
82
82
  end
83
83
 
84
84
  it "should detect raid size" do
85
85
  @plugin.run
86
- @plugin[:mdadm][:md0][:size].should == 2794.16
86
+ expect(@plugin[:mdadm][:md0][:size]).to eq(2794.16)
87
87
  end
88
88
 
89
89
  it "should detect raid metadata level" do
90
90
  @plugin.run
91
- @plugin[:mdadm][:md0][:version].should == 1.2
91
+ expect(@plugin[:mdadm][:md0][:version]).to eq(1.2)
92
92
  end
93
93
 
94
94
  device_counts = { :raid => 6, :total => 6, :active => 6, :working => 6, :failed => 0, :spare => 0 }
95
95
  device_counts.each_pair do |item, expected_value|
96
96
  it "should detect device count of \"#{item}\"" do
97
97
  @plugin.run
98
- @plugin[:mdadm][:md0][:device_counts][item].should == expected_value
98
+ expect(@plugin[:mdadm][:md0][:device_counts][item]).to eq(expected_value)
99
99
  end
100
100
  end
101
101
 
@@ -23,20 +23,20 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
23
23
  describe Ohai::System, "Linux plugin platform" do
24
24
  before(:each) do
25
25
  @plugin = get_plugin("linux/platform")
26
- @plugin.stub(:collect_os).and_return(:linux)
26
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
27
27
  @plugin[:lsb] = Mash.new
28
- File.stub(:exists?).with("/etc/debian_version").and_return(false)
29
- File.stub(:exists?).with("/etc/redhat-release").and_return(false)
30
- File.stub(:exists?).with("/etc/gentoo-release").and_return(false)
31
- File.stub(:exists?).with("/etc/exherbo-release").and_return(false)
32
- File.stub(:exists?).with("/etc/SuSE-release").and_return(false)
33
- File.stub(:exists?).with("/etc/arch-release").and_return(false)
34
- File.stub(:exists?).with("/etc/system-release").and_return(false)
35
- File.stub(:exists?).with("/etc/slackware-version").and_return(false)
36
- File.stub(:exists?).with("/etc/enterprise-release").and_return(false)
37
- File.stub(:exists?).with("/etc/oracle-release").and_return(false)
38
- File.stub(:exists?).with("/etc/parallels-release").and_return(false)
39
- File.stub(:exists?).with("/usr/bin/raspi-config").and_return(false)
28
+ allow(File).to receive(:exists?).with("/etc/debian_version").and_return(false)
29
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(false)
30
+ allow(File).to receive(:exists?).with("/etc/gentoo-release").and_return(false)
31
+ allow(File).to receive(:exists?).with("/etc/exherbo-release").and_return(false)
32
+ allow(File).to receive(:exists?).with("/etc/SuSE-release").and_return(false)
33
+ allow(File).to receive(:exists?).with("/etc/arch-release").and_return(false)
34
+ allow(File).to receive(:exists?).with("/etc/system-release").and_return(false)
35
+ allow(File).to receive(:exists?).with("/etc/slackware-version").and_return(false)
36
+ allow(File).to receive(:exists?).with("/etc/enterprise-release").and_return(false)
37
+ allow(File).to receive(:exists?).with("/etc/oracle-release").and_return(false)
38
+ allow(File).to receive(:exists?).with("/etc/parallels-release").and_return(false)
39
+ allow(File).to receive(:exists?).with("/usr/bin/raspi-config").and_return(false)
40
40
  end
41
41
 
42
42
  describe "on lsb compliant distributions" do
@@ -47,83 +47,83 @@ describe Ohai::System, "Linux plugin platform" do
47
47
 
48
48
  it "should set platform to lowercased lsb[:id]" do
49
49
  @plugin.run
50
- @plugin[:platform].should == "ubuntu"
50
+ expect(@plugin[:platform]).to eq("ubuntu")
51
51
  end
52
52
 
53
53
  it "should set platform_version to lsb[:release]" do
54
54
  @plugin.run
55
- @plugin[:platform_version].should == "8.04"
55
+ expect(@plugin[:platform_version]).to eq("8.04")
56
56
  end
57
57
 
58
58
  it "should set platform to ubuntu and platform_family to debian [:lsb][:id] contains Ubuntu" do
59
59
  @plugin[:lsb][:id] = "Ubuntu"
60
60
  @plugin.run
61
- @plugin[:platform].should == "ubuntu"
62
- @plugin[:platform_family].should == "debian"
61
+ expect(@plugin[:platform]).to eq("ubuntu")
62
+ expect(@plugin[:platform_family]).to eq("debian")
63
63
  end
64
64
 
65
65
  it "should set platform to linuxmint and platform_family to debian [:lsb][:id] contains LinuxMint" do
66
66
  @plugin[:lsb][:id] = "LinuxMint"
67
67
  @plugin.run
68
- @plugin[:platform].should == "linuxmint"
69
- @plugin[:platform_family].should == "debian"
68
+ expect(@plugin[:platform]).to eq("linuxmint")
69
+ expect(@plugin[:platform_family]).to eq("debian")
70
70
  end
71
71
 
72
72
  it "should set platform to debian and platform_family to debian [:lsb][:id] contains Debian" do
73
73
  @plugin[:lsb][:id] = "Debian"
74
74
  @plugin.run
75
- @plugin[:platform].should == "debian"
76
- @plugin[:platform_family].should == "debian"
75
+ expect(@plugin[:platform]).to eq("debian")
76
+ expect(@plugin[:platform_family]).to eq("debian")
77
77
  end
78
78
 
79
79
  it "should set platform to redhat and platform_family to rhel when [:lsb][:id] contains Redhat" do
80
80
  @plugin[:lsb][:id] = "RedHatEnterpriseServer"
81
81
  @plugin[:lsb][:release] = "5.7"
82
82
  @plugin.run
83
- @plugin[:platform].should == "redhat"
84
- @plugin[:platform_family].should == "rhel"
83
+ expect(@plugin[:platform]).to eq("redhat")
84
+ expect(@plugin[:platform_family]).to eq("rhel")
85
85
  end
86
86
 
87
87
  it "should set platform to amazon and platform_family to rhel when [:lsb][:id] contains Amazon" do
88
88
  @plugin[:lsb][:id] = "AmazonAMI"
89
89
  @plugin[:lsb][:release] = "2011.09"
90
90
  @plugin.run
91
- @plugin[:platform].should == "amazon"
92
- @plugin[:platform_family].should == "rhel"
91
+ expect(@plugin[:platform]).to eq("amazon")
92
+ expect(@plugin[:platform_family]).to eq("rhel")
93
93
  end
94
94
 
95
95
  it "should set platform to scientific when [:lsb][:id] contains ScientificSL" do
96
96
  @plugin[:lsb][:id] = "ScientificSL"
97
97
  @plugin[:lsb][:release] = "5.7"
98
98
  @plugin.run
99
- @plugin[:platform].should == "scientific"
99
+ expect(@plugin[:platform]).to eq("scientific")
100
100
  end
101
101
 
102
102
  it "should set platform to ibm_powerkvm and platform_family to rhel when [:lsb][:id] contains IBM_PowerKVM" do
103
103
  @plugin[:lsb][:id] = "IBM_PowerKVM"
104
104
  @plugin[:lsb][:release] = "2.1"
105
105
  @plugin.run
106
- @plugin[:platform].should == "ibm_powerkvm"
107
- @plugin[:platform_family].should == "rhel"
106
+ expect(@plugin[:platform]).to eq("ibm_powerkvm")
107
+ expect(@plugin[:platform_family]).to eq("rhel")
108
108
  end
109
109
  end
110
110
 
111
111
  describe "on debian" do
112
112
  before(:each) do
113
113
  @plugin.lsb = nil
114
- File.should_receive(:exists?).with("/etc/debian_version").and_return(true)
114
+ expect(File).to receive(:exists?).with("/etc/debian_version").and_return(true)
115
115
  end
116
116
 
117
117
  it "should read the version from /etc/debian_version" do
118
- File.should_receive(:read).with("/etc/debian_version").and_return("5.0")
118
+ expect(File).to receive(:read).with("/etc/debian_version").and_return("5.0")
119
119
  @plugin.run
120
- @plugin[:platform_version].should == "5.0"
120
+ expect(@plugin[:platform_version]).to eq("5.0")
121
121
  end
122
122
 
123
123
  it "should correctly strip any newlines" do
124
- File.should_receive(:read).with("/etc/debian_version").and_return("5.0\n")
124
+ expect(File).to receive(:read).with("/etc/debian_version").and_return("5.0\n")
125
125
  @plugin.run
126
- @plugin[:platform_version].should == "5.0"
126
+ expect(@plugin[:platform_version]).to eq("5.0")
127
127
  end
128
128
 
129
129
  # Ubuntu has /etc/debian_version as well
@@ -131,43 +131,43 @@ describe Ohai::System, "Linux plugin platform" do
131
131
  @plugin[:lsb][:id] = "Ubuntu"
132
132
  @plugin[:lsb][:release] = "8.04"
133
133
  @plugin.run
134
- @plugin[:platform].should == "ubuntu"
134
+ expect(@plugin[:platform]).to eq("ubuntu")
135
135
  end
136
136
 
137
137
  # Raspbian is a debian clone
138
138
  it "should detect Raspbian as itself with debian as the family" do
139
- File.should_receive(:exists?).with("/usr/bin/raspi-config").and_return(true)
140
- File.should_receive(:read).with("/etc/debian_version").and_return("wheezy/sid")
139
+ expect(File).to receive(:exists?).with("/usr/bin/raspi-config").and_return(true)
140
+ expect(File).to receive(:read).with("/etc/debian_version").and_return("wheezy/sid")
141
141
  @plugin.run
142
- @plugin[:platform].should == "raspbian"
143
- @plugin[:platform_family].should == "debian"
142
+ expect(@plugin[:platform]).to eq("raspbian")
143
+ expect(@plugin[:platform_family]).to eq("debian")
144
144
  end
145
145
  end
146
146
 
147
147
  describe "on slackware" do
148
148
  before(:each) do
149
149
  @plugin.lsb = nil
150
- File.should_receive(:exists?).with("/etc/slackware-version").and_return(true)
150
+ expect(File).to receive(:exists?).with("/etc/slackware-version").and_return(true)
151
151
  end
152
152
 
153
153
  it "should set platform and platform_family to slackware" do
154
- File.should_receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
154
+ expect(File).to receive(:read).with("/etc/slackware-version").and_return("Slackware 12.0.0")
155
155
  @plugin.run
156
- @plugin[:platform].should == "slackware"
157
- @plugin[:platform_family].should == "slackware"
156
+ expect(@plugin[:platform]).to eq("slackware")
157
+ expect(@plugin[:platform_family]).to eq("slackware")
158
158
  end
159
159
  end
160
160
 
161
161
  describe "on arch" do
162
162
  before(:each) do
163
163
  @plugin.lsb = nil
164
- File.should_receive(:exists?).with("/etc/arch-release").and_return(true)
164
+ expect(File).to receive(:exists?).with("/etc/arch-release").and_return(true)
165
165
  end
166
166
 
167
167
  it "should set platform to arch and platform_family to arch" do
168
168
  @plugin.run
169
- @plugin[:platform].should == "arch"
170
- @plugin[:platform_family].should == "arch"
169
+ expect(@plugin[:platform]).to eq("arch")
170
+ expect(@plugin[:platform_family]).to eq("arch")
171
171
  end
172
172
 
173
173
  end
@@ -175,27 +175,27 @@ describe Ohai::System, "Linux plugin platform" do
175
175
  describe "on gentoo" do
176
176
  before(:each) do
177
177
  @plugin.lsb = nil
178
- File.should_receive(:exists?).with("/etc/gentoo-release").and_return(true)
178
+ expect(File).to receive(:exists?).with("/etc/gentoo-release").and_return(true)
179
179
  end
180
180
 
181
181
  it "should set platform and platform_family to gentoo" do
182
- File.should_receive(:read).with("/etc/gentoo-release").and_return("Gentoo Base System release 1.20.1.1")
182
+ expect(File).to receive(:read).with("/etc/gentoo-release").and_return("Gentoo Base System release 1.20.1.1")
183
183
  @plugin.run
184
- @plugin[:platform].should == "gentoo"
185
- @plugin[:platform_family].should == "gentoo"
184
+ expect(@plugin[:platform]).to eq("gentoo")
185
+ expect(@plugin[:platform_family]).to eq("gentoo")
186
186
  end
187
187
  end
188
188
 
189
189
  describe "on exherbo" do
190
190
  before(:each) do
191
191
  @plugin.lsb = nil
192
- File.should_receive(:exists?).with("/etc/exherbo-release").and_return(true)
192
+ expect(File).to receive(:exists?).with("/etc/exherbo-release").and_return(true)
193
193
  end
194
194
 
195
195
  it "should set platform and platform_family to exherbo" do
196
196
  @plugin.run
197
- @plugin[:platform].should == "exherbo"
198
- @plugin[:platform_family].should == "exherbo"
197
+ expect(@plugin[:platform]).to eq("exherbo")
198
+ expect(@plugin[:platform_family]).to eq("exherbo")
199
199
  end
200
200
  end
201
201
 
@@ -205,96 +205,96 @@ describe Ohai::System, "Linux plugin platform" do
205
205
  @plugin[:lsb][:id] = "RedHatEnterpriseServer"
206
206
  @plugin[:lsb][:release] = "6.1"
207
207
  @plugin.run
208
- @plugin[:platform].should == "redhat"
209
- @plugin[:platform_version].should == "6.1"
210
- @plugin[:platform_family].should == "rhel"
208
+ expect(@plugin[:platform]).to eq("redhat")
209
+ expect(@plugin[:platform_version]).to eq("6.1")
210
+ expect(@plugin[:platform_family]).to eq("rhel")
211
211
  end
212
212
 
213
213
  it "should set the platform to centos and platform_family to rhel" do
214
214
  @plugin[:lsb][:id] = "CentOS"
215
215
  @plugin[:lsb][:release] = "5.4"
216
216
  @plugin.run
217
- @plugin[:platform].should == "centos"
218
- @plugin[:platform_version].should == "5.4"
219
- @plugin[:platform_family].should == "rhel"
217
+ expect(@plugin[:platform]).to eq("centos")
218
+ expect(@plugin[:platform_version]).to eq("5.4")
219
+ expect(@plugin[:platform_family]).to eq("rhel")
220
220
  end
221
221
 
222
222
  it "should set the platform_family to rhel if the LSB name is oracle-ish" do
223
223
  @plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
224
224
  @plugin.run
225
- @plugin[:platform_family].should == "rhel"
225
+ expect(@plugin[:platform_family]).to eq("rhel")
226
226
  end
227
227
 
228
228
  it "should set the platform_family to rhel if the LSB name is amazon-ish" do
229
229
  @plugin[:lsb][:id] = "Amazon"
230
230
  @plugin.run
231
- @plugin[:platform_family].should == "rhel"
231
+ expect(@plugin[:platform_family]).to eq("rhel")
232
232
  end
233
233
 
234
234
  it "should set the platform_family to fedora if the LSB name is fedora-ish" do
235
235
  @plugin[:lsb][:id] = "Fedora"
236
236
  @plugin.run
237
- @plugin[:platform_family].should == "fedora"
237
+ expect(@plugin[:platform_family]).to eq("fedora")
238
238
  end
239
239
 
240
240
  it "should set the platform_family to redhat if the LSB name is scientific-ish" do
241
241
  @plugin[:lsb][:id] = "Scientific"
242
242
  @plugin.run
243
- @plugin[:platform_family].should == "rhel"
243
+ expect(@plugin[:platform_family]).to eq("rhel")
244
244
  end
245
245
 
246
246
  it "should set the platform_family to redhat if the LSB name is ibm-ish" do
247
247
  @plugin[:lsb][:id] = "IBM_PowerKVM"
248
248
  @plugin.run
249
- @plugin[:platform_family].should == "rhel"
249
+ expect(@plugin[:platform_family]).to eq("rhel")
250
250
  end
251
251
  end
252
252
 
253
253
  describe "without lsb_release results" do
254
254
  before(:each) do
255
255
  @plugin.lsb = nil
256
- File.should_receive(:exists?).with("/etc/redhat-release").and_return(true)
256
+ expect(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
257
257
  end
258
258
 
259
259
  it "should read the platform as centos and version as 5.3" do
260
- File.should_receive(:read).with("/etc/redhat-release").and_return("CentOS release 5.3")
260
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("CentOS release 5.3")
261
261
  @plugin.run
262
- @plugin[:platform].should == "centos"
262
+ expect(@plugin[:platform]).to eq("centos")
263
263
  end
264
264
 
265
265
  it "may be that someone munged Red Hat to be RedHat" do
266
- File.should_receive(:read).with("/etc/redhat-release").and_return("RedHat release 5.3")
266
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("RedHat release 5.3")
267
267
  @plugin.run
268
- @plugin[:platform].should == "redhat"
269
- @plugin[:platform_version].should == "5.3"
268
+ expect(@plugin[:platform]).to eq("redhat")
269
+ expect(@plugin[:platform_version]).to eq("5.3")
270
270
  end
271
271
 
272
272
  it "should read the platform as redhat and version as 5.3" do
273
- File.should_receive(:read).with("/etc/redhat-release").and_return("Red Hat release 5.3")
273
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat release 5.3")
274
274
  @plugin.run
275
- @plugin[:platform].should == "redhat"
276
- @plugin[:platform_version].should == "5.3"
275
+ expect(@plugin[:platform]).to eq("redhat")
276
+ expect(@plugin[:platform_version]).to eq("5.3")
277
277
  end
278
278
 
279
279
  it "should read the platform as fedora and version as 13 (rawhide)" do
280
- File.should_receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
280
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
281
281
  @plugin.run
282
- @plugin[:platform].should == "fedora"
283
- @plugin[:platform_version].should == "13 (rawhide)"
282
+ expect(@plugin[:platform]).to eq("fedora")
283
+ expect(@plugin[:platform_version]).to eq("13 (rawhide)")
284
284
  end
285
285
 
286
286
  it "should read the platform as fedora and version as 10" do
287
- File.should_receive(:read).with("/etc/redhat-release").and_return("Fedora release 10")
287
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 10")
288
288
  @plugin.run
289
- @plugin[:platform].should == "fedora"
290
- @plugin[:platform_version].should == "10"
289
+ expect(@plugin[:platform]).to eq("fedora")
290
+ expect(@plugin[:platform_version]).to eq("10")
291
291
  end
292
292
 
293
293
  it "should read the platform as fedora and version as 13 using to_i" do
294
- File.should_receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
294
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Fedora release 13 (Rawhide)")
295
295
  @plugin.run
296
- @plugin[:platform].should == "fedora"
297
- @plugin[:platform_version].to_i.should == 13
296
+ expect(@plugin[:platform]).to eq("fedora")
297
+ expect(@plugin[:platform_version].to_i).to eq(13)
298
298
  end
299
299
 
300
300
  end
@@ -305,14 +305,14 @@ describe Ohai::System, "Linux plugin platform" do
305
305
  it "should read the platform as parallels and version as 6.0.5" do
306
306
  @plugin[:lsb][:id] = "CloudLinuxServer"
307
307
  @plugin[:lsb][:release] = "6.5"
308
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
309
- File.stub(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
310
- File.should_receive(:exists?).with("/etc/parallels-release").and_return(true)
311
- File.should_receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
308
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
309
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
310
+ expect(File).to receive(:exists?).with("/etc/parallels-release").and_return(true)
311
+ expect(File).to receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
312
312
  @plugin.run
313
- @plugin[:platform].should == "parallels"
314
- @plugin[:platform_version].should == "6.0.5"
315
- @plugin[:platform_family].should == "rhel"
313
+ expect(@plugin[:platform]).to eq("parallels")
314
+ expect(@plugin[:platform_version]).to eq("6.0.5")
315
+ expect(@plugin[:platform_family]).to eq("rhel")
316
316
  end
317
317
  end
318
318
 
@@ -322,14 +322,14 @@ describe Ohai::System, "Linux plugin platform" do
322
322
  end
323
323
 
324
324
  it "should read the platform as parallels and version as 6.0.5" do
325
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
326
- File.stub(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
327
- File.should_receive(:exists?).with("/etc/parallels-release").and_return(true)
328
- File.should_receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
325
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
326
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("CloudLinux Server release 6.5 (Pavel Popovich)")
327
+ expect(File).to receive(:exists?).with("/etc/parallels-release").and_return(true)
328
+ expect(File).to receive(:read).with("/etc/parallels-release").and_return("Parallels Cloud Server 6.0.5 (20007)")
329
329
  @plugin.run
330
- @plugin[:platform].should == "parallels"
331
- @plugin[:platform_version].should == "6.0.5"
332
- @plugin[:platform_family].should == "rhel"
330
+ expect(@plugin[:platform]).to eq("parallels")
331
+ expect(@plugin[:platform_version]).to eq("6.0.5")
332
+ expect(@plugin[:platform_family]).to eq("rhel")
333
333
  end
334
334
  end
335
335
  end
@@ -339,25 +339,25 @@ describe Ohai::System, "Linux plugin platform" do
339
339
  it "should read the platform as oracle and version as 5.7" do
340
340
  @plugin[:lsb][:id] = "EnterpriseEnterpriseServer"
341
341
  @plugin[:lsb][:release] = "5.7"
342
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
343
- File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
344
- File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
345
- File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
342
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
343
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
344
+ expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
345
+ expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
346
346
  @plugin.run
347
- @plugin[:platform].should == "oracle"
348
- @plugin[:platform_version].should == "5.7"
347
+ expect(@plugin[:platform]).to eq("oracle")
348
+ expect(@plugin[:platform_version]).to eq("5.7")
349
349
  end
350
350
 
351
351
  it "should read the platform as oracle and version as 6.1" do
352
352
  @plugin[:lsb][:id] = "OracleServer"
353
353
  @plugin[:lsb][:release] = "6.1"
354
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
355
- File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
356
- File.should_receive(:exists?).with("/etc/oracle-release").and_return(true)
357
- File.should_receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
354
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
355
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
356
+ expect(File).to receive(:exists?).with("/etc/oracle-release").and_return(true)
357
+ expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
358
358
  @plugin.run
359
- @plugin[:platform].should == "oracle"
360
- @plugin[:platform_version].should == "6.1"
359
+ expect(@plugin[:platform]).to eq("oracle")
360
+ expect(@plugin[:platform_version]).to eq("6.1")
361
361
  end
362
362
  end
363
363
 
@@ -367,60 +367,60 @@ describe Ohai::System, "Linux plugin platform" do
367
367
  end
368
368
 
369
369
  it "should read the platform as oracle and version as 5" do
370
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
371
- File.stub(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
372
- File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
373
- File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
370
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
371
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
372
+ expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
373
+ expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5 (Carthage)")
374
374
  @plugin.run
375
- @plugin[:platform].should == "oracle"
376
- @plugin[:platform_version].should == "5"
375
+ expect(@plugin[:platform]).to eq("oracle")
376
+ expect(@plugin[:platform_version]).to eq("5")
377
377
  end
378
378
 
379
379
  it "should read the platform as oracle and version as 5.1" do
380
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
381
- File.stub(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
382
- File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
383
- File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
380
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
381
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
382
+ expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
383
+ expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.1 (Carthage)")
384
384
  @plugin.run
385
- @plugin[:platform].should == "oracle"
386
- @plugin[:platform_version].should == "5.1"
385
+ expect(@plugin[:platform]).to eq("oracle")
386
+ expect(@plugin[:platform_version]).to eq("5.1")
387
387
  end
388
388
 
389
389
  it "should read the platform as oracle and version as 5.7" do
390
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
391
- File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
392
- File.should_receive(:exists?).with("/etc/enterprise-release").and_return(true)
393
- File.should_receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
390
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
391
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 5.7 (Tikanga)")
392
+ expect(File).to receive(:exists?).with("/etc/enterprise-release").and_return(true)
393
+ expect(File).to receive(:read).with("/etc/enterprise-release").and_return("Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)")
394
394
  @plugin.run
395
- @plugin[:platform].should == "oracle"
396
- @plugin[:platform_version].should == "5.7"
395
+ expect(@plugin[:platform]).to eq("oracle")
396
+ expect(@plugin[:platform_version]).to eq("5.7")
397
397
  end
398
398
 
399
399
  it "should read the platform as oracle and version as 6.0" do
400
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
401
- File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.0 (Santiago)")
402
- File.should_receive(:exists?).with("/etc/oracle-release").and_return(true)
403
- File.should_receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.0")
400
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
401
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.0 (Santiago)")
402
+ expect(File).to receive(:exists?).with("/etc/oracle-release").and_return(true)
403
+ expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.0")
404
404
  @plugin.run
405
- @plugin[:platform].should == "oracle"
406
- @plugin[:platform_version].should == "6.0"
405
+ expect(@plugin[:platform]).to eq("oracle")
406
+ expect(@plugin[:platform_version]).to eq("6.0")
407
407
  end
408
408
 
409
409
  it "should read the platform as oracle and version as 6.1" do
410
- File.stub(:exists?).with("/etc/redhat-release").and_return(true)
411
- File.stub(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
412
- File.should_receive(:exists?).with("/etc/oracle-release").and_return(true)
413
- File.should_receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
410
+ allow(File).to receive(:exists?).with("/etc/redhat-release").and_return(true)
411
+ allow(File).to receive(:read).with("/etc/redhat-release").and_return("Red Hat Enterprise Linux Server release 6.1 (Santiago)")
412
+ expect(File).to receive(:exists?).with("/etc/oracle-release").and_return(true)
413
+ expect(File).to receive(:read).with("/etc/oracle-release").and_return("Oracle Linux Server release 6.1")
414
414
  @plugin.run
415
- @plugin[:platform].should == "oracle"
416
- @plugin[:platform_version].should == "6.1"
415
+ expect(@plugin[:platform]).to eq("oracle")
416
+ expect(@plugin[:platform_version]).to eq("6.1")
417
417
  end
418
418
  end
419
419
  end
420
420
 
421
421
  describe "on suse" do
422
422
  before(:each) do
423
- File.should_receive(:exists?).with("/etc/SuSE-release").and_return(true)
423
+ expect(File).to receive(:exists?).with("/etc/SuSE-release").and_return(true)
424
424
  end
425
425
 
426
426
  describe "with lsb_release results" do
@@ -430,10 +430,10 @@ describe Ohai::System, "Linux plugin platform" do
430
430
 
431
431
  it "should read the platform as opensuse on openSUSE" do
432
432
  @plugin[:lsb][:release] = "12.1"
433
- File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
433
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.1 (x86_64)\nVERSION = 12.1\nCODENAME = Asparagus\n")
434
434
  @plugin.run
435
- @plugin[:platform].should == "opensuse"
436
- @plugin[:platform_family].should == "suse"
435
+ expect(@plugin[:platform]).to eq("opensuse")
436
+ expect(@plugin[:platform_family]).to eq("suse")
437
437
  end
438
438
  end
439
439
 
@@ -443,57 +443,57 @@ describe Ohai::System, "Linux plugin platform" do
443
443
  end
444
444
 
445
445
  it "should set platform and platform_family to suse and bogus verion to 10.0" do
446
- File.should_receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
446
+ expect(File).to receive(:read).with("/etc/SuSE-release").at_least(:once).and_return("VERSION = 10.0")
447
447
  @plugin.run
448
- @plugin[:platform].should == "suse"
449
- @plugin[:platform_family].should == "suse"
448
+ expect(@plugin[:platform]).to eq("suse")
449
+ expect(@plugin[:platform_family]).to eq("suse")
450
450
  end
451
451
 
452
452
  it "should read the version as 10.1 for bogus SLES 10" do
453
- File.should_receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
453
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 10 (i586)\nVERSION = 10\nPATCHLEVEL = 1\n")
454
454
  @plugin.run
455
- @plugin[:platform].should == "suse"
456
- @plugin[:platform_version].should == "10.1"
457
- @plugin[:platform_family].should == "suse"
455
+ expect(@plugin[:platform]).to eq("suse")
456
+ expect(@plugin[:platform_version]).to eq("10.1")
457
+ expect(@plugin[:platform_family]).to eq("suse")
458
458
  end
459
459
 
460
460
  it "should read the version as 11.2" do
461
- File.should_receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
461
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("SUSE Linux Enterprise Server 11.2 (i586)\nVERSION = 11\nPATCHLEVEL = 2\n")
462
462
  @plugin.run
463
- @plugin[:platform].should == "suse"
464
- @plugin[:platform_version].should == "11.2"
465
- @plugin[:platform_family].should == "suse"
463
+ expect(@plugin[:platform]).to eq("suse")
464
+ expect(@plugin[:platform_version]).to eq("11.2")
465
+ expect(@plugin[:platform_family]).to eq("suse")
466
466
  end
467
467
 
468
468
  it "[OHAI-272] should read the version as 11.3" do
469
- File.should_receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3")
469
+ expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.3 (x86_64)\nVERSION = 11.3")
470
470
  @plugin.run
471
- @plugin[:platform].should == "opensuse"
472
- @plugin[:platform_version].should == "11.3"
473
- @plugin[:platform_family].should == "suse"
471
+ expect(@plugin[:platform]).to eq("opensuse")
472
+ expect(@plugin[:platform_version]).to eq("11.3")
473
+ expect(@plugin[:platform_family]).to eq("suse")
474
474
  end
475
475
 
476
476
  it "[OHAI-272] should read the version as 9.1" do
477
- File.should_receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1")
477
+ expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("SuSE Linux 9.1 (i586)\nVERSION = 9.1")
478
478
  @plugin.run
479
- @plugin[:platform].should == "suse"
480
- @plugin[:platform_version].should == "9.1"
481
- @plugin[:platform_family].should == "suse"
479
+ expect(@plugin[:platform]).to eq("suse")
480
+ expect(@plugin[:platform_version]).to eq("9.1")
481
+ expect(@plugin[:platform_family]).to eq("suse")
482
482
  end
483
483
 
484
484
  it "[OHAI-272] should read the version as 11.4" do
485
- File.should_receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon")
485
+ expect(File).to receive(:read).with("/etc/SuSE-release").exactly(1).times.and_return("openSUSE 11.4 (i586)\nVERSION = 11.4\nCODENAME = Celadon")
486
486
  @plugin.run
487
- @plugin[:platform].should == "opensuse"
488
- @plugin[:platform_version].should == "11.4"
489
- @plugin[:platform_family].should == "suse"
487
+ expect(@plugin[:platform]).to eq("opensuse")
488
+ expect(@plugin[:platform_version]).to eq("11.4")
489
+ expect(@plugin[:platform_family]).to eq("suse")
490
490
  end
491
491
 
492
492
  it "should read the platform as opensuse on openSUSE" do
493
- File.should_receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n")
493
+ expect(File).to receive(:read).with("/etc/SuSE-release").and_return("openSUSE 12.2 (x86_64)\nVERSION = 12.2\nCODENAME = Mantis\n")
494
494
  @plugin.run
495
- @plugin[:platform].should == "opensuse"
496
- @plugin[:platform_family].should == "suse"
495
+ expect(@plugin[:platform]).to eq("opensuse")
496
+ expect(@plugin[:platform_family]).to eq("suse")
497
497
  end
498
498
  end
499
499
  end