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
@@ -20,24 +20,24 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
20
20
  describe Ohai::System, "Aix plugin platform" do
21
21
  before(:each) do
22
22
  @plugin = get_plugin("aix/platform")
23
- @plugin.stub(:collect_os).and_return(:aix)
23
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
24
24
  kernel = Mash.new
25
25
  kernel[:name] = "aix"
26
26
  kernel[:version] = "1"
27
27
  kernel[:release] = "0"
28
- @plugin.stub(:kernel).and_return(kernel)
28
+ allow(@plugin).to receive(:kernel).and_return(kernel)
29
29
  @plugin.run
30
30
  end
31
31
 
32
32
  it "should set platform to aix" do
33
- @plugin[:platform].should == "aix"
33
+ expect(@plugin[:platform]).to eq("aix")
34
34
  end
35
35
 
36
36
  it "should set the platform_version" do
37
- @plugin[:platform_version].should == "1.0"
37
+ expect(@plugin[:platform_version]).to eq("1.0")
38
38
  end
39
39
 
40
40
  it "should set platform_family" do
41
- @plugin[:platform_family].should == @plugin[:platform]
41
+ expect(@plugin[:platform_family]).to eq(@plugin[:platform])
42
42
  end
43
43
  end
@@ -21,20 +21,20 @@ describe Ohai::System, "Aix plugin uptime" do
21
21
 
22
22
  before(:each) do
23
23
  @plugin = get_plugin("aix/uptime")
24
- @plugin.stub(:collect_os).and_return(:aix)
25
- Time.stub_chain(:now, :to_i).and_return(1412072511)
26
- Time.stub_chain(:now, :zone).and_return("IST")
27
- DateTime.stub_chain(:parse, :strftime, :to_i).and_return(1411561320)
28
- @plugin.stub(:shell_out).with("who -b").and_return(mock_shell_out(0, " . system boot Sep 24 17:52", nil))
24
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
25
+ allow(Time).to receive_message_chain(:now, :to_i).and_return(1412072511)
26
+ allow(Time).to receive_message_chain(:now, :zone).and_return("IST")
27
+ allow(DateTime).to receive_message_chain(:parse, :strftime, :to_i).and_return(1411561320)
28
+ allow(@plugin).to receive(:shell_out).with("who -b").and_return(mock_shell_out(0, " . system boot Sep 24 17:52", nil))
29
29
 
30
30
  @plugin.run
31
31
  end
32
32
 
33
33
  it "should set uptime_seconds to uptime" do
34
- @plugin[:uptime_seconds].should == 511191
34
+ expect(@plugin[:uptime_seconds]).to eq(511191)
35
35
  end
36
36
 
37
37
  it "should set uptime to a human readable date" do
38
- @plugin[:uptime].should == "5 days 21 hours 59 minutes 51 seconds"
38
+ expect(@plugin[:uptime]).to eq("5 days 21 hours 59 minutes 51 seconds")
39
39
  end
40
40
  end
@@ -30,8 +30,8 @@ describe Ohai::System, "AIX virtualization plugin" do
30
30
  end
31
31
 
32
32
  it "uname -L detects the LPAR number and name" do
33
- plugin[:virtualization][:lpar_no].should == "29"
34
- plugin[:virtualization][:lpar_name].should == "l273pp027"
33
+ expect(plugin[:virtualization][:lpar_no]).to eq("29")
34
+ expect(plugin[:virtualization][:lpar_name]).to eq("l273pp027")
35
35
  end
36
36
  end
37
37
 
@@ -46,7 +46,7 @@ describe Ohai::System, "AIX virtualization plugin" do
46
46
  end
47
47
 
48
48
  it "uname -W detects the WPAR number" do
49
- plugin[:virtualization][:wpar_no].should == "42"
49
+ expect(plugin[:virtualization][:wpar_no]).to eq("42")
50
50
  end
51
51
  end
52
52
 
@@ -27,45 +27,45 @@ describe Ohai::System, "plugin azure" do
27
27
 
28
28
  describe "with azure cloud file" do
29
29
  before(:each) do
30
- File.stub(:exist?).with('/etc/chef/ohai/hints/azure.json').and_return(true)
31
- File.stub(:read).with('/etc/chef/ohai/hints/azure.json').and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
32
- File.stub(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(true)
33
- File.stub(:read).with('C:\chef\ohai\hints/azure.json').and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
30
+ allow(File).to receive(:exist?).with('/etc/chef/ohai/hints/azure.json').and_return(true)
31
+ allow(File).to receive(:read).with('/etc/chef/ohai/hints/azure.json').and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
32
+ allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(true)
33
+ allow(File).to receive(:read).with('C:\chef\ohai\hints/azure.json').and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
34
34
  @plugin.run
35
35
  end
36
36
 
37
37
  it 'should set the azure cloud attributes' do
38
- @plugin[:azure].should_not be_nil
39
- @plugin[:azure]['public_ip'].should == "137.135.46.202"
40
- @plugin[:azure]['vm_name'].should == "test-vm"
41
- @plugin[:azure]['public_fqdn'].should == "service.cloudapp.net"
42
- @plugin[:azure]['public_ssh_port'].should == "22"
43
- @plugin[:azure]['public_winrm_port'].should == "5985"
38
+ expect(@plugin[:azure]).not_to be_nil
39
+ expect(@plugin[:azure]['public_ip']).to eq("137.135.46.202")
40
+ expect(@plugin[:azure]['vm_name']).to eq("test-vm")
41
+ expect(@plugin[:azure]['public_fqdn']).to eq("service.cloudapp.net")
42
+ expect(@plugin[:azure]['public_ssh_port']).to eq("22")
43
+ expect(@plugin[:azure]['public_winrm_port']).to eq("5985")
44
44
  end
45
45
 
46
46
  end
47
47
 
48
48
  describe "without azure cloud file" do
49
49
  before(:each) do
50
- File.stub(:exist?).with('/etc/chef/ohai/hints/azure.json').and_return(false)
51
- File.stub(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
50
+ allow(File).to receive(:exist?).with('/etc/chef/ohai/hints/azure.json').and_return(false)
51
+ allow(File).to receive(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
52
52
  end
53
53
 
54
54
  it 'should not behave like azure' do
55
- @plugin[:azure].should be_nil
55
+ expect(@plugin[:azure]).to be_nil
56
56
  end
57
57
  end
58
58
 
59
59
  describe "with rackspace cloud file" do
60
60
  before(:each) do
61
- File.stub(:exist?).with('/etc/chef/ohai/hints/rackspace.json').and_return(true)
62
- File.stub(:read).with('/etc/chef/ohai/hints/rackspace.json').and_return('')
63
- File.stub(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
64
- File.stub(:read).with('C:\chef\ohai\hints/rackspace.json').and_return('')
61
+ allow(File).to receive(:exist?).with('/etc/chef/ohai/hints/rackspace.json').and_return(true)
62
+ allow(File).to receive(:read).with('/etc/chef/ohai/hints/rackspace.json').and_return('')
63
+ allow(File).to receive(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
64
+ allow(File).to receive(:read).with('C:\chef\ohai\hints/rackspace.json').and_return('')
65
65
  end
66
66
 
67
67
  it 'should not behave like azure' do
68
- @plugin[:azure].should be_nil
68
+ expect(@plugin[:azure]).to be_nil
69
69
  end
70
70
  end
71
71
 
@@ -107,202 +107,202 @@ describe Ohai::System, "plugin c" do
107
107
 
108
108
  @plugin[:languages] = Mash.new
109
109
  #gcc
110
- @plugin.stub(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
110
+ allow(@plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
111
111
  #glibc
112
- @plugin.stub(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_3_4, ""))
112
+ allow(@plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_3_4, ""))
113
113
  #ms cl
114
- @plugin.stub(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
114
+ allow(@plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
115
115
  #ms vs
116
- @plugin.stub(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
116
+ allow(@plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
117
117
  #ibm xlc
118
- @plugin.stub(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
118
+ allow(@plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
119
119
  #sun pro
120
- @plugin.stub(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
120
+ allow(@plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
121
121
  #hpux cc
122
- @plugin.stub(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
122
+ allow(@plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
123
123
  end
124
124
 
125
125
  #gcc
126
126
  it "should get the gcc version from running gcc -v" do
127
- @plugin.should_receive(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
127
+ expect(@plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(0, "", C_GCC))
128
128
  @plugin.run
129
129
  end
130
130
 
131
131
  it "should set languages[:c][:gcc][:version]" do
132
132
  @plugin.run
133
- @plugin.languages[:c][:gcc][:version].should eql("3.4.6")
133
+ expect(@plugin.languages[:c][:gcc][:version]).to eql("3.4.6")
134
134
  end
135
135
 
136
136
  it "should set languages[:c][:gcc][:description]" do
137
137
  @plugin.run
138
- @plugin.languages[:c][:gcc][:description].should eql(C_GCC.split($/).last)
138
+ expect(@plugin.languages[:c][:gcc][:description]).to eql(C_GCC.split($/).last)
139
139
  end
140
140
 
141
141
  it "should not set the languages[:c][:gcc] tree up if gcc command fails" do
142
- @plugin.stub(:shell_out).with("gcc -v").and_return(mock_shell_out(1, "", ""))
142
+ allow(@plugin).to receive(:shell_out).with("gcc -v").and_return(mock_shell_out(1, "", ""))
143
143
  @plugin.run
144
- @plugin[:languages][:c].should_not have_key(:gcc) if @plugin[:languages][:c]
144
+ expect(@plugin[:languages][:c]).not_to have_key(:gcc) if @plugin[:languages][:c]
145
145
  end
146
146
 
147
147
  #glibc
148
148
  it "should get the glibc x.x.x version from running /lib/libc.so.6" do
149
- @plugin.should_receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_3_4, ""))
149
+ expect(@plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_3_4, ""))
150
150
  @plugin.run
151
151
  end
152
152
 
153
153
  it "should set languages[:c][:glibc][:version]" do
154
154
  @plugin.run
155
- @plugin.languages[:c][:glibc][:version].should eql("2.3.4")
155
+ expect(@plugin.languages[:c][:glibc][:version]).to eql("2.3.4")
156
156
  end
157
157
 
158
158
  it "should set languages[:c][:glibc][:description]" do
159
159
  @plugin.run
160
- @plugin.languages[:c][:glibc][:description].should eql(C_GLIBC_2_3_4.split($/).first)
160
+ expect(@plugin.languages[:c][:glibc][:description]).to eql(C_GLIBC_2_3_4.split($/).first)
161
161
  end
162
162
 
163
163
  it "should not set the languages[:c][:glibc] tree up if glibc command fails" do
164
- @plugin.stub(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(1, "", ""))
165
- @plugin.stub(:shell_out).with("/lib64/libc.so.6").and_return(mock_shell_out(1, "", ""))
164
+ allow(@plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(1, "", ""))
165
+ allow(@plugin).to receive(:shell_out).with("/lib64/libc.so.6").and_return(mock_shell_out(1, "", ""))
166
166
  @plugin.run
167
- @plugin[:languages][:c].should_not have_key(:glibc) if @plugin[:languages][:c]
167
+ expect(@plugin[:languages][:c]).not_to have_key(:glibc) if @plugin[:languages][:c]
168
168
  end
169
169
 
170
170
  it "should get the glibc x.x version from running /lib/libc.so.6" do
171
- @plugin.stub(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_5, ""))
172
- @plugin.should_receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_5, ""))
171
+ allow(@plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_5, ""))
172
+ expect(@plugin).to receive(:shell_out).with("/lib/libc.so.6").and_return(mock_shell_out(0, C_GLIBC_2_5, ""))
173
173
  @plugin.run
174
- @plugin.languages[:c][:glibc][:version].should eql("2.5")
174
+ expect(@plugin.languages[:c][:glibc][:version]).to eql("2.5")
175
175
  end
176
176
 
177
177
  #ms cl
178
178
  it "should get the cl version from running cl /?" do
179
- @plugin.should_receive(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
179
+ expect(@plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(0, "", C_CL))
180
180
  @plugin.run
181
181
  end
182
182
 
183
183
  it "should set languages[:c][:cl][:version]" do
184
184
  @plugin.run
185
- @plugin.languages[:c][:cl][:version].should eql("14.00.50727.762")
185
+ expect(@plugin.languages[:c][:cl][:version]).to eql("14.00.50727.762")
186
186
  end
187
187
 
188
188
  it "should set languages[:c][:cl][:description]" do
189
189
  @plugin.run
190
- @plugin.languages[:c][:cl][:description].should eql(C_CL.split($/).first)
190
+ expect(@plugin.languages[:c][:cl][:description]).to eql(C_CL.split($/).first)
191
191
  end
192
192
 
193
193
  it "should not set the languages[:c][:cl] tree up if cl command fails" do
194
- @plugin.stub(:shell_out).with("cl /\?").and_return(mock_shell_out(1, "", ""))
194
+ allow(@plugin).to receive(:shell_out).with("cl /\?").and_return(mock_shell_out(1, "", ""))
195
195
  @plugin.run
196
- @plugin[:languages][:c].should_not have_key(:cl) if @plugin[:languages][:c]
196
+ expect(@plugin[:languages][:c]).not_to have_key(:cl) if @plugin[:languages][:c]
197
197
  end
198
198
 
199
199
  #ms vs
200
200
  it "should get the vs version from running devenv.com /?" do
201
- @plugin.should_receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
201
+ expect(@plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(0, C_VS, ""))
202
202
  @plugin.run
203
203
  end
204
204
 
205
205
  it "should set languages[:c][:vs][:version]" do
206
206
  @plugin.run
207
- @plugin.languages[:c][:vs][:version].should eql("8.0.50727.762")
207
+ expect(@plugin.languages[:c][:vs][:version]).to eql("8.0.50727.762")
208
208
  end
209
209
 
210
210
  it "should set languages[:c][:vs][:description]" do
211
211
  @plugin.run
212
- @plugin.languages[:c][:vs][:description].should eql(C_VS.split($/)[1])
212
+ expect(@plugin.languages[:c][:vs][:description]).to eql(C_VS.split($/)[1])
213
213
  end
214
214
 
215
215
  it "should not set the languages[:c][:vs] tree up if devenv command fails" do
216
- @plugin.stub(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(1, "", ""))
216
+ allow(@plugin).to receive(:shell_out).with("devenv.com /\?").and_return(mock_shell_out(1, "", ""))
217
217
  @plugin.run
218
- @plugin[:languages][:c].should_not have_key(:vs) if @plugin[:languages][:c]
218
+ expect(@plugin[:languages][:c]).not_to have_key(:vs) if @plugin[:languages][:c]
219
219
  end
220
220
 
221
221
  #ibm xlc
222
222
  it "should get the xlc version from running xlc -qversion" do
223
- @plugin.should_receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
223
+ expect(@plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(0, C_XLC, ""))
224
224
  @plugin.run
225
225
  end
226
226
 
227
227
  it "should set languages[:c][:xlc][:version]" do
228
228
  @plugin.run
229
- @plugin.languages[:c][:xlc][:version].should eql("9.0")
229
+ expect(@plugin.languages[:c][:xlc][:version]).to eql("9.0")
230
230
  end
231
231
 
232
232
  it "should set languages[:c][:xlc][:description]" do
233
233
  @plugin.run
234
- @plugin.languages[:c][:xlc][:description].should eql(C_XLC.split($/).first)
234
+ expect(@plugin.languages[:c][:xlc][:description]).to eql(C_XLC.split($/).first)
235
235
  end
236
236
 
237
237
  it "should not set the languages[:c][:xlc] tree up if xlc command fails" do
238
- @plugin.stub(:shell_out).with("xlc -qversion").and_return(mock_shell_out(1, "", ""))
238
+ allow(@plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(1, "", ""))
239
239
  @plugin.run
240
- @plugin[:languages][:c].should_not have_key(:xlc) if @plugin[:languages][:c]
240
+ expect(@plugin[:languages][:c]).not_to have_key(:xlc) if @plugin[:languages][:c]
241
241
  end
242
242
 
243
243
  it "should set the languages[:c][:xlc] tree up if xlc exit status is 249" do
244
- @plugin.stub(:shell_out).with("xlc -qversion").and_return(mock_shell_out(63744, "", ""))
244
+ allow(@plugin).to receive(:shell_out).with("xlc -qversion").and_return(mock_shell_out(63744, "", ""))
245
245
  @plugin.run
246
- @plugin[:languages][:c].should_not have_key(:xlc) if @plugin[:languages][:c]
246
+ expect(@plugin[:languages][:c]).not_to have_key(:xlc) if @plugin[:languages][:c]
247
247
  end
248
248
 
249
249
  #sun pro
250
250
  it "should get the cc version from running cc -V -flags" do
251
- @plugin.should_receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
251
+ expect(@plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", C_SUN))
252
252
  @plugin.run
253
253
  end
254
254
 
255
255
  it "should set languages[:c][:sunpro][:version]" do
256
256
  @plugin.run
257
- @plugin.languages[:c][:sunpro][:version].should eql("5.8")
257
+ expect(@plugin.languages[:c][:sunpro][:version]).to eql("5.8")
258
258
  end
259
259
 
260
260
  it "should set languages[:c][:sunpro][:description]" do
261
261
  @plugin.run
262
- @plugin.languages[:c][:sunpro][:description].should eql(C_SUN.chomp)
262
+ expect(@plugin.languages[:c][:sunpro][:description]).to eql(C_SUN.chomp)
263
263
  end
264
264
 
265
265
  it "should not set the languages[:c][:sunpro] tree up if cc command fails" do
266
- @plugin.stub(:shell_out).with("cc -V -flags").and_return(mock_shell_out(1, "", ""))
266
+ allow(@plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(1, "", ""))
267
267
  @plugin.run
268
- @plugin[:languages][:c].should_not have_key(:sunpro) if @plugin[:languages][:c]
268
+ expect(@plugin[:languages][:c]).not_to have_key(:sunpro) if @plugin[:languages][:c]
269
269
  end
270
270
 
271
271
  it "should not set the languages[:c][:sunpro] tree if the corresponding cc command fails on linux" do
272
272
  fedora_error_message = "cc: error trying to exec 'i686-redhat-linux-gcc--flags': execvp: No such file or directory"
273
273
 
274
- @plugin.stub(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", fedora_error_message))
274
+ allow(@plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", fedora_error_message))
275
275
  @plugin.run
276
- @plugin[:languages][:c].should_not have_key(:sunpro) if @plugin[:languages][:c]
276
+ expect(@plugin[:languages][:c]).not_to have_key(:sunpro) if @plugin[:languages][:c]
277
277
  end
278
278
 
279
279
  it "should not set the languages[:c][:sunpro] tree if the corresponding cc command fails on hpux" do
280
280
  hpux_error_message = "cc: warning 901: unknown option: `-flags': use +help for online documentation.\ncc: HP C/aC++ B3910B A.06.25 [Nov 30 2009]"
281
- @plugin.stub(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", hpux_error_message))
281
+ allow(@plugin).to receive(:shell_out).with("cc -V -flags").and_return(mock_shell_out(0, "", hpux_error_message))
282
282
  @plugin.run
283
- @plugin[:languages][:c].should_not have_key(:sunpro) if @plugin[:languages][:c]
283
+ expect(@plugin[:languages][:c]).not_to have_key(:sunpro) if @plugin[:languages][:c]
284
284
  end
285
285
 
286
286
  #hpux cc
287
287
  it "should get the cc version from running what cc" do
288
- @plugin.should_receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
288
+ expect(@plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(0, C_HPUX, ""))
289
289
  @plugin.run
290
290
  end
291
291
 
292
292
  it "should set languages[:c][:hpcc][:version]" do
293
293
  @plugin.run
294
- @plugin.languages[:c][:hpcc][:version].should eql("B.11.11.16")
294
+ expect(@plugin.languages[:c][:hpcc][:version]).to eql("B.11.11.16")
295
295
  end
296
296
 
297
297
  it "should set languages[:c][:hpcc][:description]" do
298
298
  @plugin.run
299
- @plugin.languages[:c][:hpcc][:description].should eql(C_HPUX.split($/)[3].strip)
299
+ expect(@plugin.languages[:c][:hpcc][:description]).to eql(C_HPUX.split($/)[3].strip)
300
300
  end
301
301
 
302
302
  it "should not set the languages[:c][:hpcc] tree up if cc command fails" do
303
- @plugin.stub(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(1, "", ""))
303
+ allow(@plugin).to receive(:shell_out).with("what /opt/ansic/bin/cc").and_return(mock_shell_out(1, "", ""))
304
304
  @plugin.run
305
- @plugin[:languages][:c].should_not have_key(:hpcc) if @plugin[:languages][:c]
305
+ expect(@plugin[:languages][:c]).not_to have_key(:hpcc) if @plugin[:languages][:c]
306
306
  end
307
307
 
308
308
  end
@@ -30,7 +30,7 @@ begin
30
30
 
31
31
  it "should set [:chef_packages][:chef][:version] to the current chef version", :if => defined?(Chef) do
32
32
  @plugin.run
33
- @plugin[:chef_packages][:chef][:version].should == Chef::VERSION
33
+ expect(@plugin[:chef_packages][:chef][:version]).to eq(Chef::VERSION)
34
34
  end
35
35
 
36
36
  pending "would set [:chef_packages][:chef][:version] if chef was available", :unless => defined?(Chef)
@@ -31,7 +31,7 @@ describe Ohai::System, "plugin cloud" do
31
31
  @plugin[:azure] = nil
32
32
  @plugin[:cloudstack] = nil
33
33
  @plugin.run
34
- @plugin[:cloud].should be_nil
34
+ expect(@plugin[:cloud]).to be_nil
35
35
  end
36
36
  end
37
37
 
@@ -43,18 +43,18 @@ describe Ohai::System, "plugin cloud" do
43
43
  it "populates cloud public ip" do
44
44
  @plugin[:ec2]['public_ipv4'] = "174.129.150.8"
45
45
  @plugin.run
46
- @plugin[:cloud][:public_ips][0].should == @plugin[:ec2]['public_ipv4']
46
+ expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:ec2]['public_ipv4'])
47
47
  end
48
48
 
49
49
  it "populates cloud private ip" do
50
50
  @plugin[:ec2]['local_ipv4'] = "10.252.42.149"
51
51
  @plugin.run
52
- @plugin[:cloud][:private_ips][0].should == @plugin[:ec2]['local_ipv4']
52
+ expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:ec2]['local_ipv4'])
53
53
  end
54
54
 
55
55
  it "populates cloud provider" do
56
56
  @plugin.run
57
- @plugin[:cloud][:provider].should == "ec2"
57
+ expect(@plugin[:cloud][:provider]).to eq("ec2")
58
58
  end
59
59
  end
60
60
 
@@ -66,42 +66,42 @@ describe Ohai::System, "plugin cloud" do
66
66
  it "populates cloud public ip" do
67
67
  @plugin[:rackspace][:public_ipv4] = "174.129.150.8"
68
68
  @plugin.run
69
- @plugin[:cloud][:public_ipv4].should == @plugin[:rackspace][:public_ipv4]
69
+ expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:rackspace][:public_ipv4])
70
70
  end
71
71
 
72
72
  it "populates cloud public ipv6" do
73
73
  @plugin[:rackspace][:public_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
74
74
  @plugin.run
75
- @plugin[:cloud][:public_ipv6].should == @plugin[:rackspace][:public_ipv6]
75
+ expect(@plugin[:cloud][:public_ipv6]).to eq(@plugin[:rackspace][:public_ipv6])
76
76
  end
77
77
 
78
78
  it "populates cloud private ip" do
79
79
  @plugin[:rackspace][:local_ipv4] = "10.252.42.149"
80
80
  @plugin.run
81
- @plugin[:cloud][:local_ipv4].should == @plugin[:rackspace][:local_ipv4]
81
+ expect(@plugin[:cloud][:local_ipv4]).to eq(@plugin[:rackspace][:local_ipv4])
82
82
  end
83
83
 
84
84
  it "populates cloud private ipv6" do
85
85
  @plugin[:rackspace][:local_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
86
86
  @plugin.run
87
- @plugin[:cloud][:local_ipv6].should == @plugin[:rackspace][:local_ipv6]
87
+ expect(@plugin[:cloud][:local_ipv6]).to eq(@plugin[:rackspace][:local_ipv6])
88
88
  end
89
89
 
90
90
  it "populates first cloud public ip" do
91
91
  @plugin[:rackspace][:public_ipv4] = "174.129.150.8"
92
92
  @plugin.run
93
- @plugin[:cloud][:public_ips].first.should == @plugin[:rackspace][:public_ipv4]
93
+ expect(@plugin[:cloud][:public_ips].first).to eq(@plugin[:rackspace][:public_ipv4])
94
94
  end
95
95
 
96
96
  it "populates first cloud public ip" do
97
97
  @plugin[:rackspace][:local_ipv4] = "174.129.150.8"
98
98
  @plugin.run
99
- @plugin[:cloud][:private_ips].first.should == @plugin[:rackspace][:local_ipv4]
99
+ expect(@plugin[:cloud][:private_ips].first).to eq(@plugin[:rackspace][:local_ipv4])
100
100
  end
101
101
 
102
102
  it "populates cloud provider" do
103
103
  @plugin.run
104
- @plugin[:cloud][:provider].should == "rackspace"
104
+ expect(@plugin[:cloud][:provider]).to eq("rackspace")
105
105
  end
106
106
  end
107
107
 
@@ -113,24 +113,24 @@ describe Ohai::System, "plugin cloud" do
113
113
  it "populates cloud public ip" do
114
114
  @plugin[:linode]['public_ip'] = "174.129.150.8"
115
115
  @plugin.run
116
- @plugin[:cloud][:public_ips][0].should == @plugin[:linode][:public_ip]
116
+ expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:linode][:public_ip])
117
117
  end
118
118
 
119
119
  it "populates cloud private ip" do
120
120
  @plugin[:linode]['private_ip'] = "10.252.42.149"
121
121
  @plugin.run
122
- @plugin[:cloud][:private_ips][0].should == @plugin[:linode][:private_ip]
122
+ expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:linode][:private_ip])
123
123
  end
124
124
 
125
125
  it "populates first cloud public ip" do
126
126
  @plugin[:linode]['public_ip'] = "174.129.150.8"
127
127
  @plugin.run
128
- @plugin[:cloud][:public_ips].first.should == @plugin[:linode][:public_ip]
128
+ expect(@plugin[:cloud][:public_ips].first).to eq(@plugin[:linode][:public_ip])
129
129
  end
130
130
 
131
131
  it "populates cloud provider" do
132
132
  @plugin.run
133
- @plugin[:cloud][:provider].should == "linode"
133
+ expect(@plugin[:cloud][:provider]).to eq("linode")
134
134
  end
135
135
  end
136
136
 
@@ -142,18 +142,18 @@ describe Ohai::System, "plugin cloud" do
142
142
  it "populates cloud public ip" do
143
143
  @plugin[:eucalyptus]['public_ipv4'] = "174.129.150.8"
144
144
  @plugin.run
145
- @plugin[:cloud][:public_ips][0].should == @plugin[:eucalyptus]['public_ipv4']
145
+ expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:eucalyptus]['public_ipv4'])
146
146
  end
147
147
 
148
148
  it "populates cloud private ip" do
149
149
  @plugin[:eucalyptus]['local_ipv4'] = "10.252.42.149"
150
150
  @plugin.run
151
- @plugin[:cloud][:private_ips][0].should == @plugin[:eucalyptus]['local_ipv4']
151
+ expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:eucalyptus]['local_ipv4'])
152
152
  end
153
153
 
154
154
  it "populates cloud provider" do
155
155
  @plugin.run
156
- @plugin[:cloud][:provider].should == "eucalyptus"
156
+ expect(@plugin[:cloud][:provider]).to eq("eucalyptus")
157
157
  end
158
158
  end
159
159
 
@@ -165,44 +165,44 @@ describe Ohai::System, "plugin cloud" do
165
165
  it "populates cloud public ip" do
166
166
  @plugin[:azure]['public_ip'] = "174.129.150.8"
167
167
  @plugin.run
168
- @plugin[:cloud][:public_ips][0].should == @plugin[:azure]['public_ip']
169
- @plugin[:cloud][:public_ipv4].should == @plugin[:azure]['public_ip']
168
+ expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:azure]['public_ip'])
169
+ expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:azure]['public_ip'])
170
170
  end
171
171
 
172
172
  it "populates cloud vm_name" do
173
173
  @plugin[:azure]['vm_name'] = "linux-vm"
174
174
  @plugin.run
175
- @plugin[:cloud][:vm_name].should == @plugin[:azure]['vm_name']
175
+ expect(@plugin[:cloud][:vm_name]).to eq(@plugin[:azure]['vm_name'])
176
176
  end
177
177
 
178
178
  it "populates cloud public_fqdn" do
179
179
  @plugin[:azure]['public_fqdn'] = "linux-vm-svc.cloudapp.net"
180
180
  @plugin.run
181
- @plugin[:cloud][:public_fqdn].should == @plugin[:azure]['public_fqdn']
182
- @plugin[:cloud][:public_hostname].should == @plugin[:azure]['public_fqdn']
181
+ expect(@plugin[:cloud][:public_fqdn]).to eq(@plugin[:azure]['public_fqdn'])
182
+ expect(@plugin[:cloud][:public_hostname]).to eq(@plugin[:azure]['public_fqdn'])
183
183
  end
184
184
 
185
185
  it "populates cloud public_ssh_port" do
186
186
  @plugin[:azure]['public_ssh_port'] = "22"
187
187
  @plugin.run
188
- @plugin[:cloud][:public_ssh_port].should == @plugin[:azure]['public_ssh_port']
188
+ expect(@plugin[:cloud][:public_ssh_port]).to eq(@plugin[:azure]['public_ssh_port'])
189
189
  end
190
190
 
191
191
  it "should not populate cloud public_ssh_port when winrm is used" do
192
192
  @plugin[:azure]['public_winrm_port'] = "5985"
193
193
  @plugin.run
194
- @plugin[:cloud][:public_ssh_port].should be_nil
194
+ expect(@plugin[:cloud][:public_ssh_port]).to be_nil
195
195
  end
196
196
 
197
197
  it "populates cloud public_winrm_port" do
198
198
  @plugin[:azure]['public_winrm_port'] = "5985"
199
199
  @plugin.run
200
- @plugin[:cloud][:public_winrm_port].should == @plugin[:azure]['public_winrm_port']
200
+ expect(@plugin[:cloud][:public_winrm_port]).to eq(@plugin[:azure]['public_winrm_port'])
201
201
  end
202
202
 
203
203
  it "populates cloud provider" do
204
204
  @plugin.run
205
- @plugin[:cloud][:provider].should == "azure"
205
+ expect(@plugin[:cloud][:provider]).to eq("azure")
206
206
  end
207
207
  end
208
208
 
@@ -214,24 +214,24 @@ describe Ohai::System, "plugin cloud" do
214
214
  it "populates cloud public ip" do
215
215
  @plugin[:cloudstack]['public_ipv4'] = "174.129.150.8"
216
216
  @plugin.run
217
- @plugin[:cloud][:public_ips][0].should == @plugin[:cloudstack]['public_ipv4']
217
+ expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:cloudstack]['public_ipv4'])
218
218
  end
219
219
 
220
220
  it "populates cloud private ip" do
221
221
  @plugin[:cloudstack]['local_ipv4'] = "10.252.42.149"
222
222
  @plugin.run
223
- @plugin[:cloud][:private_ips][0].should == @plugin[:cloudstack]['local_ipv4']
223
+ expect(@plugin[:cloud][:private_ips][0]).to eq(@plugin[:cloudstack]['local_ipv4'])
224
224
  end
225
225
 
226
226
  it "populates cloud provider" do
227
227
  @plugin.run
228
- @plugin[:cloud][:provider].should == "cloudstack"
228
+ expect(@plugin[:cloud][:provider]).to eq("cloudstack")
229
229
  end
230
230
 
231
231
  it "populates vm id" do
232
232
  @plugin[:cloudstack]['vm_id'] = "8983fb85-fb7f-46d6-8af1-c1b6666fec39"
233
233
  @plugin.run
234
- @plugin[:cloud][:vm_id].should == @plugin[:cloudstack]['vm_id']
234
+ expect(@plugin[:cloud][:vm_id]).to eq(@plugin[:cloudstack]['vm_id'])
235
235
  end
236
236
  end
237
237