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
@@ -27,24 +27,24 @@ describe Ohai::System, "plugin lua" do
27
27
  @plugin = get_plugin("lua")
28
28
  @plugin[:languages] = Mash.new
29
29
  @stderr = "Lua 5.1.2 Copyright (C) 1994-2008 Lua.org, PUC-Rio\n"
30
- @plugin.stub(:shell_out).with("lua -v").and_return(mock_shell_out(0, "", @stderr))
30
+ allow(@plugin).to receive(:shell_out).with("lua -v").and_return(mock_shell_out(0, "", @stderr))
31
31
  end
32
32
 
33
33
  it "should get the lua version from running lua -v" do
34
- @plugin.should_receive(:shell_out).with("lua -v").and_return(mock_shell_out(0, "", @stderr))
34
+ expect(@plugin).to receive(:shell_out).with("lua -v").and_return(mock_shell_out(0, "", @stderr))
35
35
  @plugin.run
36
36
  end
37
37
 
38
38
  it "should set languages[:lua][:version]" do
39
39
  @plugin.run
40
- @plugin.languages[:lua][:version].should eql("5.1.2")
40
+ expect(@plugin.languages[:lua][:version]).to eql("5.1.2")
41
41
  end
42
42
 
43
43
  it "should not set the languages[:lua] tree up if lua command fails" do
44
44
  @stderr = "Lua 5.1.2 Copyright (C) 1994-2008 Lua.org, PUC-Rio\n"
45
- @plugin.stub(:shell_out).with("lua -v").and_return(mock_shell_out(1, "", @stderr))
45
+ allow(@plugin).to receive(:shell_out).with("lua -v").and_return(mock_shell_out(1, "", @stderr))
46
46
  @plugin.run
47
- @plugin.languages.should_not have_key(:lua)
47
+ expect(@plugin.languages).not_to have_key(:lua)
48
48
  end
49
49
 
50
50
  end
@@ -25,24 +25,24 @@ describe Ohai::System, "plugin mono" do
25
25
  @plugin = get_plugin("mono")
26
26
  @plugin[:languages] = Mash.new
27
27
  @stdout = "Mono JIT compiler version 1.2.6 (tarball)\nCopyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com\n"
28
- @plugin.stub(:shell_out).with("mono -V").and_return(mock_shell_out(0, @stdout, ""))
28
+ allow(@plugin).to receive(:shell_out).with("mono -V").and_return(mock_shell_out(0, @stdout, ""))
29
29
  end
30
30
 
31
31
  it "should get the mono version from running mono -V" do
32
- @plugin.should_receive(:shell_out).with("mono -V").and_return(mock_shell_out(0, @stdout, ""))
32
+ expect(@plugin).to receive(:shell_out).with("mono -V").and_return(mock_shell_out(0, @stdout, ""))
33
33
  @plugin.run
34
34
  end
35
35
 
36
36
  it "should set languages[:mono][:version]" do
37
37
  @plugin.run
38
- @plugin.languages[:mono][:version].should eql("1.2.6")
38
+ expect(@plugin.languages[:mono][:version]).to eql("1.2.6")
39
39
  end
40
40
 
41
41
  it "should not set the languages[:mono] tree up if mono command fails" do
42
42
  @stdout = "Mono JIT compiler version 1.2.6 (tarball)\nCopyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com\n"
43
- @plugin.stub(:shell_out).with("mono -V").and_return(mock_shell_out(1, @stdout, ""))
43
+ allow(@plugin).to receive(:shell_out).with("mono -V").and_return(mock_shell_out(1, @stdout, ""))
44
44
  @plugin.run
45
- @plugin.languages.should_not have_key(:mono)
45
+ expect(@plugin.languages).not_to have_key(:mono)
46
46
  end
47
47
 
48
48
  end
@@ -22,10 +22,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
  describe Ohai::System, "NetBSD hostname plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("hostname")
25
- @plugin.stub(:collect_os).and_return(:netbsd)
26
- @plugin.stub(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie\n", ""))
27
- @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
28
- @plugin.stub(:resolve_fqdn).and_return("katie.bethell")
25
+ allow(@plugin).to receive(:collect_os).and_return(:netbsd)
26
+ allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie\n", ""))
27
+ allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
28
+ allow(@plugin).to receive(:resolve_fqdn).and_return("katie.bethell")
29
29
  end
30
30
 
31
31
  it_should_check_from("linux::hostname", "hostname", "hostname -s", "katie")
@@ -34,11 +34,11 @@ describe Ohai::System, "NetBSD hostname plugin" do
34
34
 
35
35
  it "should use #resolve_fqdn to find the fqdn" do
36
36
  @plugin.run
37
- @plugin[:fqdn].should == "katie.bethell"
37
+ expect(@plugin[:fqdn]).to eq("katie.bethell")
38
38
  end
39
39
 
40
40
  it "should set the domain to everything after the first dot of the fqdn" do
41
41
  @plugin.run
42
- @plugin[:domain].should == "bethell"
42
+ expect(@plugin[:domain]).to eq("bethell")
43
43
  end
44
44
  end
@@ -22,15 +22,15 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
22
22
  describe Ohai::System, "NetBSD kernel plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("kernel")
25
- @plugin.stub(:collect_os).and_return(:netbsd)
26
- @plugin.stub(:init_kernel).and_return({})
27
- @plugin.stub(:shell_out).with("uname -i").and_return(mock_shell_out(0, "foo", ""))
28
- @plugin.stub(:shell_out).with("sysctl kern.securelevel").and_return(mock_shell_out(0, "kern.securelevel: 1\n", ""))
29
- @plugin.stub(:shell_out).with("#{ Ohai.abs_path( "/usr/bin/modstat" )}").and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
25
+ allow(@plugin).to receive(:collect_os).and_return(:netbsd)
26
+ allow(@plugin).to receive(:init_kernel).and_return({})
27
+ allow(@plugin).to receive(:shell_out).with("uname -i").and_return(mock_shell_out(0, "foo", ""))
28
+ allow(@plugin).to receive(:shell_out).with("sysctl kern.securelevel").and_return(mock_shell_out(0, "kern.securelevel: 1\n", ""))
29
+ allow(@plugin).to receive(:shell_out).with("#{ Ohai.abs_path( "/usr/bin/modstat" )}").and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
30
30
  end
31
31
 
32
32
  it "should set the kernel_os to the kernel_name value" do
33
33
  @plugin.run
34
- @plugin[:kernel][:os].should == @plugin[:kernel][:name]
34
+ expect(@plugin[:kernel][:os]).to eq(@plugin[:kernel][:name])
35
35
  end
36
36
  end
@@ -21,18 +21,18 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
21
21
  describe Ohai::System, "NetBSD plugin platform" do
22
22
  before(:each) do
23
23
  @plugin = get_plugin("netbsd/platform")
24
- @plugin.stub(:shell_out).with("uname -s").and_return(mock_shell_out(0, "NetBSD\n", ""))
25
- @plugin.stub(:shell_out).with("uname -r").and_return(mock_shell_out(0, "4.5\n", ""))
26
- @plugin.stub(:collect_os).and_return(:netbsd)
24
+ allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "NetBSD\n", ""))
25
+ allow(@plugin).to receive(:shell_out).with("uname -r").and_return(mock_shell_out(0, "4.5\n", ""))
26
+ allow(@plugin).to receive(:collect_os).and_return(:netbsd)
27
27
  end
28
28
 
29
29
  it "should set platform to lowercased lsb[:id]" do
30
30
  @plugin.run
31
- @plugin[:platform].should == "netbsd"
31
+ expect(@plugin[:platform]).to eq("netbsd")
32
32
  end
33
33
 
34
34
  it "should set platform_version to lsb[:release]" do
35
35
  @plugin.run
36
- @plugin[:platform_version].should == "4.5"
36
+ expect(@plugin[:platform_version]).to eq("4.5")
37
37
  end
38
38
  end
@@ -20,8 +20,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
20
20
 
21
21
  def it_doesnt_fail
22
22
  it "doesnt fail" do
23
- Ohai::Log.stub(:warn)
24
- Ohai::Log.should_not_receive(:debug).with(/^Plugin network threw exception/)
23
+ allow(Ohai::Log).to receive(:warn)
24
+ expect(Ohai::Log).not_to receive(:debug).with(/^Plugin network threw exception/)
25
25
  @plugin.run
26
26
  end
27
27
  end
@@ -32,11 +32,11 @@ def it_populates_ipaddress_attributes
32
32
 
33
33
  it "populates ipaddress, macaddress and ip6address" do
34
34
  begin
35
- Ohai::Log.stub(:warn)
36
- Ohai::Log.should_not_receive(:debug).with(/^Plugin network threw exception/)
35
+ allow(Ohai::Log).to receive(:warn)
36
+ expect(Ohai::Log).not_to receive(:debug).with(/^Plugin network threw exception/)
37
37
  @plugin.run
38
38
  %w{ ipaddress macaddress ip6address }.each do |attribute|
39
- @plugin.should have_key(attribute)
39
+ expect(@plugin).to have_key(attribute)
40
40
  end
41
41
  rescue Exception
42
42
  puts "RSpec context: #{source}"
@@ -313,9 +313,9 @@ describe Ohai::System, "Network Plugin" do
313
313
 
314
314
  it "detects {ip,ip6,mac}address" do
315
315
  @plugin.run
316
- @plugin["ipaddress"].should == "192.168.66.33"
317
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
318
- @plugin["ip6address"].should == "3ffe:1111:2222::33"
316
+ expect(@plugin["ipaddress"]).to eq("192.168.66.33")
317
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
318
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222::33")
319
319
  end
320
320
  end
321
321
 
@@ -330,18 +330,18 @@ describe Ohai::System, "Network Plugin" do
330
330
 
331
331
  it "detects {ip,ip6}address" do
332
332
  @plugin.run
333
- @plugin["ipaddress"].should == "192.168.66.33"
334
- @plugin["ip6address"].should == "3ffe:1111:3333::1"
333
+ expect(@plugin["ipaddress"]).to eq("192.168.66.33")
334
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:3333::1")
335
335
  end
336
336
 
337
337
  it "set macaddress from the ipv4 setup" do
338
338
  @plugin.run
339
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
339
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
340
340
  end
341
341
 
342
342
  it "informs about this setup" do
343
- Ohai::Log.should_receive(:debug).with(/^ipaddress and ip6address are set from different interfaces/)
344
- Ohai::Log.stub(:debug)
343
+ expect(Ohai::Log).to receive(:debug).with(/^ipaddress and ip6address are set from different interfaces/)
344
+ allow(Ohai::Log).to receive(:debug)
345
345
  @plugin.run
346
346
  end
347
347
  end
@@ -359,19 +359,19 @@ describe Ohai::System, "Network Plugin" do
359
359
 
360
360
  it "detects {ip,ip6}address" do
361
361
  @plugin.run
362
- @plugin["ipaddress"].should == "192.168.66.33"
363
- @plugin["ip6address"].should == "3ffe:1111:3333::1"
362
+ expect(@plugin["ipaddress"]).to eq("192.168.66.33")
363
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:3333::1")
364
364
  end
365
365
 
366
366
  it "doesn't set macaddress, ipv4 setup is valid and has precedence over ipv6" do
367
- Ohai::Log.should_not_receive(:warn).with(/^unable to detect macaddress/)
367
+ expect(Ohai::Log).not_to receive(:warn).with(/^unable to detect macaddress/)
368
368
  @plugin.run
369
- @plugin["macaddress"].should be_nil
369
+ expect(@plugin["macaddress"]).to be_nil
370
370
  end
371
371
 
372
372
  it "informs about this setup" do
373
- Ohai::Log.should_receive(:debug).with(/^ipaddress and ip6address are set from different interfaces/)
374
- Ohai::Log.stub(:debug)
373
+ expect(Ohai::Log).to receive(:debug).with(/^ipaddress and ip6address are set from different interfaces/)
374
+ allow(Ohai::Log).to receive(:debug)
375
375
  @plugin.run
376
376
  end
377
377
  end
@@ -387,16 +387,16 @@ describe Ohai::System, "Network Plugin" do
387
387
  it_populates_ipaddress_attributes
388
388
 
389
389
  it "picks {ip,ip6,mac}address" do
390
- Ohai::Log.stub(:warn)
390
+ allow(Ohai::Log).to receive(:warn)
391
391
  @plugin.run
392
- @plugin["ipaddress"].should == "192.168.99.11"
393
- @plugin["macaddress"].should == "00:16:3E:2F:36:80"
394
- @plugin["ip6address"].should == "3ffe:1111:3333::1"
392
+ expect(@plugin["ipaddress"]).to eq("192.168.99.11")
393
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:80")
394
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:3333::1")
395
395
  end
396
396
 
397
397
  it "warns about this conflict" do
398
- Ohai::Log.should_receive(:debug).with(/^\[inet\] no ipaddress\/mask on eth1/).once
399
- Ohai::Log.should_receive(:debug).with(/^\[inet6\] no ipaddress\/mask on eth1/).once
398
+ expect(Ohai::Log).to receive(:debug).with(/^\[inet\] no ipaddress\/mask on eth1/).once
399
+ expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] no ipaddress\/mask on eth1/).once
400
400
  @plugin.run
401
401
  end
402
402
  end
@@ -408,11 +408,11 @@ describe Ohai::System, "Network Plugin" do
408
408
  end
409
409
 
410
410
  it "picks {ip,ip6,mac}address" do
411
- Ohai::Log.stub(:warn)
411
+ allow(Ohai::Log).to receive(:warn)
412
412
  @plugin.run
413
- @plugin["ipaddress"].should == "192.168.66.33"
414
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
415
- @plugin["ip6address"].should == "3ffe:1111:2222::33"
413
+ expect(@plugin["ipaddress"]).to eq("192.168.66.33")
414
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
415
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222::33")
416
416
  end
417
417
 
418
418
  end
@@ -425,19 +425,19 @@ describe Ohai::System, "Network Plugin" do
425
425
  it_doesnt_fail
426
426
 
427
427
  it "doesn't detect {ip,ip6,mac}address" do
428
- Ohai::Log.stub(:warn)
428
+ allow(Ohai::Log).to receive(:warn)
429
429
  @plugin.run
430
- @plugin["ipaddress"].should be_nil
431
- @plugin["macaddress"].should be_nil
432
- @plugin["ip6address"].should be_nil
430
+ expect(@plugin["ipaddress"]).to be_nil
431
+ expect(@plugin["macaddress"]).to be_nil
432
+ expect(@plugin["ip6address"]).to be_nil
433
433
  end
434
434
 
435
435
  it "warns about this conflict" do
436
- Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
437
- Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
438
- Ohai::Log.should_receive(:warn).with(/^\[inet\] no ip address on eth0/).once
439
- Ohai::Log.should_receive(:debug).with(/^unable to detect ip6address/).once
440
- Ohai::Log.should_receive(:warn).with(/^\[inet6\] no ip address on eth0/).once
436
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
437
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect macaddress/).once
438
+ expect(Ohai::Log).to receive(:warn).with(/^\[inet\] no ip address on eth0/).once
439
+ expect(Ohai::Log).to receive(:debug).with(/^unable to detect ip6address/).once
440
+ expect(Ohai::Log).to receive(:warn).with(/^\[inet6\] no ip address on eth0/).once
441
441
  @plugin.run
442
442
  end
443
443
  end
@@ -456,17 +456,17 @@ describe Ohai::System, "Network Plugin" do
456
456
  it_doesnt_fail
457
457
 
458
458
  it "doesn't detect {ip,ip6,mac}address" do
459
- Ohai::Log.stub(:warn)
459
+ allow(Ohai::Log).to receive(:warn)
460
460
  @plugin.run
461
- @plugin["ipaddress"].should be_nil
462
- @plugin["macaddress"].should be_nil
463
- @plugin["ip6address"].should be_nil
461
+ expect(@plugin["ipaddress"]).to be_nil
462
+ expect(@plugin["macaddress"]).to be_nil
463
+ expect(@plugin["ip6address"]).to be_nil
464
464
  end
465
465
 
466
466
  it "should warn about it" do
467
- Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
468
- Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
469
- Ohai::Log.should_receive(:debug).with(/^unable to detect ip6address/).once
467
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
468
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect macaddress/).once
469
+ expect(Ohai::Log).to receive(:debug).with(/^unable to detect ip6address/).once
470
470
  @plugin.run
471
471
  end
472
472
  end
@@ -505,9 +505,9 @@ describe Ohai::System, "Network Plugin" do
505
505
 
506
506
  it "sets {ip,ip6,mac}address correctly" do
507
507
  @plugin.run
508
- @plugin["ipaddress"].should == "192.168.66.33"
509
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
510
- @plugin["ip6address"].should == "3ffe:1111:2222::33"
508
+ expect(@plugin["ipaddress"]).to eq("192.168.66.33")
509
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
510
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222::33")
511
511
  end
512
512
  end
513
513
 
@@ -531,9 +531,9 @@ describe Ohai::System, "Network Plugin" do
531
531
 
532
532
  it "sets {ip,ip6,mac}address correctly" do
533
533
  @plugin.run
534
- @plugin["ipaddress"].should == "192.168.66.99"
535
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
536
- @plugin["ip6address"].should == "3ffe:1111:2222:0:4444::1"
534
+ expect(@plugin["ipaddress"]).to eq("192.168.66.99")
535
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
536
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222:0:4444::1")
537
537
  end
538
538
  end
539
539
 
@@ -569,9 +569,9 @@ describe Ohai::System, "Network Plugin" do
569
569
 
570
570
  it "sets {ip,ip6,mac}address correctly" do
571
571
  @plugin.run
572
- @plugin["ipaddress"].should == "192.168.66.33"
573
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
574
- @plugin["ip6address"].should == "3ffe:1111:2222::33"
572
+ expect(@plugin["ipaddress"]).to eq("192.168.66.33")
573
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
574
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222::33")
575
575
  end
576
576
  end
577
577
 
@@ -595,9 +595,9 @@ describe Ohai::System, "Network Plugin" do
595
595
 
596
596
  it "sets {ip,ip6,mac}address correctly" do
597
597
  @plugin.run
598
- @plugin["ipaddress"].should == "192.168.66.32"
599
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
600
- @plugin["ip6address"].should == "3ffe:1111:2222::32"
598
+ expect(@plugin["ipaddress"]).to eq("192.168.66.32")
599
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
600
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222::32")
601
601
  end
602
602
  end
603
603
  end
@@ -616,13 +616,13 @@ describe Ohai::System, "Network Plugin" do
616
616
  it_populates_ipaddress_attributes
617
617
 
618
618
  it "picks {ip,mac,ip6}address from the first interface" do
619
- Ohai::Log.should_receive(:debug).with(/^\[inet\] no default interface/).once
620
- Ohai::Log.should_receive(:debug).with(/^\[inet6\] no default interface/).once
621
- Ohai::Log.stub(:debug)
619
+ expect(Ohai::Log).to receive(:debug).with(/^\[inet\] no default interface/).once
620
+ expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] no default interface/).once
621
+ allow(Ohai::Log).to receive(:debug)
622
622
  @plugin.run
623
- @plugin["ipaddress"].should == "192.168.99.11"
624
- @plugin["macaddress"].should == "00:16:3E:2F:36:80"
625
- @plugin["ip6address"].should == "3ffe:1111:3333::1"
623
+ expect(@plugin["ipaddress"]).to eq("192.168.99.11")
624
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:80")
625
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:3333::1")
626
626
  end
627
627
  end
628
628
 
@@ -639,13 +639,13 @@ describe Ohai::System, "Network Plugin" do
639
639
  it_populates_ipaddress_attributes
640
640
 
641
641
  it "prefers global scope addressses to set {ip,mac,ip6}address" do
642
- Ohai::Log.should_receive(:debug).with(/^\[inet\] no default interface/).once
643
- Ohai::Log.should_receive(:debug).with(/^\[inet6\] no default interface/).once
644
- Ohai::Log.stub(:debug)
642
+ expect(Ohai::Log).to receive(:debug).with(/^\[inet\] no default interface/).once
643
+ expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] no default interface/).once
644
+ allow(Ohai::Log).to receive(:debug)
645
645
  @plugin.run
646
- @plugin["ipaddress"].should == "192.168.99.11"
647
- @plugin["macaddress"].should == "00:16:3E:2F:36:80"
648
- @plugin["ip6address"].should == "3ffe:1111:3333::1"
646
+ expect(@plugin["ipaddress"]).to eq("192.168.99.11")
647
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:80")
648
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:3333::1")
649
649
  end
650
650
  end
651
651
  end
@@ -663,9 +663,9 @@ describe Ohai::System, "Network Plugin" do
663
663
 
664
664
  it "picks {ip,mac,ip6}address from the default interface" do
665
665
  @plugin.run
666
- @plugin["ipaddress"].should == "192.168.99.11"
667
- @plugin["macaddress"].should == "00:16:3E:2F:36:80"
668
- @plugin["ip6address"].should == "3ffe:1111:3333::1"
666
+ expect(@plugin["ipaddress"]).to eq("192.168.99.11")
667
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:80")
668
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:3333::1")
669
669
  end
670
670
  end
671
671
 
@@ -678,7 +678,7 @@ describe Ohai::System, "Network Plugin" do
678
678
 
679
679
  it "picks {ip,mac,ip6}address from the default interface" do
680
680
  @plugin.run
681
- @plugin["ip6address"].should == "3ffe:1111:2222::33"
681
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222::33")
682
682
  end
683
683
  end
684
684
 
@@ -700,9 +700,9 @@ describe Ohai::System, "Network Plugin" do
700
700
 
701
701
  it "picks {ip,mac,ip6}address from the default interface" do
702
702
  @plugin.run
703
- @plugin["ipaddress"].should == "192.168.99.11"
704
- @plugin["macaddress"].should == "00:16:3E:2F:36:80"
705
- @plugin["ip6address"].should == "3ffe:1111:3333::1"
703
+ expect(@plugin["ipaddress"]).to eq("192.168.99.11")
704
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:80")
705
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:3333::1")
706
706
  end
707
707
  end
708
708
  end
@@ -744,9 +744,9 @@ describe Ohai::System, "Network Plugin" do
744
744
 
745
745
  it "picks {ip,mac,ip6}address from the default interface" do
746
746
  @plugin.run
747
- @plugin["ipaddress"].should == "192.168.66.99"
748
- @plugin["macaddress"].should == "00:16:3E:2F:36:81"
749
- @plugin["ip6address"].should == "3ffe:1111:2222:0:4444::1"
747
+ expect(@plugin["ipaddress"]).to eq("192.168.66.99")
748
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:81")
749
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222:0:4444::1")
750
750
  end
751
751
  end
752
752
 
@@ -762,27 +762,27 @@ describe Ohai::System, "Network Plugin" do
762
762
  it_doesnt_fail
763
763
 
764
764
  it "can't detect ipaddress" do
765
- Ohai::Log.stub(:warn)
765
+ allow(Ohai::Log).to receive(:warn)
766
766
  @plugin.run
767
- @plugin["ipaddress"].should be_nil
767
+ expect(@plugin["ipaddress"]).to be_nil
768
768
  end
769
769
 
770
770
  it "warns about not being able to set {ip,mac}address (ipv4)" do
771
- Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
772
- Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
771
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
772
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect macaddress/).once
773
773
  @plugin.run
774
774
  end
775
775
 
776
776
  it "sets {ip6,mac}address" do
777
- Ohai::Log.stub(:warn)
777
+ allow(Ohai::Log).to receive(:warn)
778
778
  @plugin.run
779
- @plugin["ip6address"].should == "3ffe:1111:2222::33"
780
- @plugin["macaddress"].should == "00:16:3E:2F:36:79"
779
+ expect(@plugin["ip6address"]).to eq("3ffe:1111:2222::33")
780
+ expect(@plugin["macaddress"]).to eq("00:16:3E:2F:36:79")
781
781
  end
782
782
 
783
783
  it "informs about macaddress being set using the ipv6 setup" do
784
- Ohai::Log.should_receive(:debug).with(/^macaddress set to 00:16:3E:2F:36:79 from the ipv6 setup/).once
785
- Ohai::Log.stub(:debug)
784
+ expect(Ohai::Log).to receive(:debug).with(/^macaddress set to 00:16:3E:2F:36:79 from the ipv6 setup/).once
785
+ allow(Ohai::Log).to receive(:debug)
786
786
  @plugin.run
787
787
  end
788
788
  end
@@ -816,13 +816,13 @@ describe Ohai::System, "Network Plugin" do
816
816
 
817
817
  it "detects ip6address" do
818
818
  @plugin.run
819
- @plugin["ip6address"].should == @expected_results[os]["ip6address"]
819
+ expect(@plugin["ip6address"]).to eq(@expected_results[os]["ip6address"])
820
820
  end
821
821
 
822
822
  it "doesn't overwrite {ip,mac}address" do
823
823
  @plugin.run
824
- @plugin["ipaddress"].should == "10.11.12.13"
825
- @plugin["macaddress"].should == "00:AA:BB:CC:DD:EE"
824
+ expect(@plugin["ipaddress"]).to eq("10.11.12.13")
825
+ expect(@plugin["macaddress"]).to eq("00:AA:BB:CC:DD:EE")
826
826
  end
827
827
  end
828
828
 
@@ -850,13 +850,13 @@ describe Ohai::System, "Network Plugin" do
850
850
 
851
851
  it "detects {ip,mac}address" do
852
852
  @plugin.run
853
- @plugin["ipaddress"].should == @expected_results[os]["ipaddress"]
854
- @plugin["macaddress"].should == @expected_results[os]["macaddress"]
853
+ expect(@plugin["ipaddress"]).to eq(@expected_results[os]["ipaddress"])
854
+ expect(@plugin["macaddress"]).to eq(@expected_results[os]["macaddress"])
855
855
  end
856
856
 
857
857
  it "doesn't overwrite ip6address" do
858
858
  @plugin.run
859
- @plugin["ip6address"].should == "3ffe:8888:9999::1"
859
+ expect(@plugin["ip6address"]).to eq("3ffe:8888:9999::1")
860
860
  end
861
861
  end
862
862
 
@@ -875,27 +875,27 @@ describe Ohai::System, "Network Plugin" do
875
875
  it_doesnt_fail
876
876
 
877
877
  it "can't detect ipaddress (ipv4)" do
878
- Ohai::Log.stub(:warn)
878
+ allow(Ohai::Log).to receive(:warn)
879
879
  @plugin.run
880
- @plugin["ipaddress"].should be_nil
880
+ expect(@plugin["ipaddress"]).to be_nil
881
881
  end
882
882
 
883
883
  it "can't detect macaddress either" do
884
- Ohai::Log.stub(:warn)
884
+ allow(Ohai::Log).to receive(:warn)
885
885
  @plugin.run
886
- @plugin["macaddress"].should be_nil
886
+ expect(@plugin["macaddress"]).to be_nil
887
887
  end
888
888
 
889
889
  it "warns about not being able to set {ip,mac}address" do
890
- Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
891
- Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
890
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
891
+ expect(Ohai::Log).to receive(:warn).with(/^unable to detect macaddress/).once
892
892
  @plugin.run
893
893
  end
894
894
 
895
895
  it "doesn't overwrite ip6address" do
896
- Ohai::Log.stub(:warn)
896
+ allow(Ohai::Log).to receive(:warn)
897
897
  @plugin.run
898
- @plugin["ip6address"].should == "3ffe:8888:9999::1"
898
+ expect(@plugin["ip6address"]).to eq("3ffe:8888:9999::1")
899
899
  end
900
900
  end
901
901
  end
@@ -925,13 +925,13 @@ describe Ohai::System, "Network Plugin" do
925
925
 
926
926
  it "detects ipaddress and overwrite macaddress" do
927
927
  @plugin.run
928
- @plugin["ipaddress"].should == @expected_results[os]["ipaddress"]
929
- @plugin["macaddress"].should == @expected_results[os]["macaddress"]
928
+ expect(@plugin["ipaddress"]).to eq(@expected_results[os]["ipaddress"])
929
+ expect(@plugin["macaddress"]).to eq(@expected_results[os]["macaddress"])
930
930
  end
931
931
 
932
932
  it "doesn't overwrite ip6address" do
933
933
  @plugin.run
934
- @plugin["ip6address"].should == "3ffe:8888:9999::1"
934
+ expect(@plugin["ip6address"]).to eq("3ffe:8888:9999::1")
935
935
  end
936
936
  end
937
937
 
@@ -951,16 +951,16 @@ describe Ohai::System, "Network Plugin" do
951
951
  it_doesnt_fail
952
952
 
953
953
  it "can't set ipaddress" do
954
- Ohai::Log.stub(:warn)
954
+ allow(Ohai::Log).to receive(:warn)
955
955
  @plugin.run
956
- @plugin["ipaddress"].should be_nil
956
+ expect(@plugin["ipaddress"]).to be_nil
957
957
  end
958
958
 
959
959
  it "doesn't overwrite {ip6,mac}address" do
960
- Ohai::Log.stub(:warn)
960
+ allow(Ohai::Log).to receive(:warn)
961
961
  @plugin.run
962
- @plugin["ip6address"].should == "3ffe:8888:9999::1"
963
- @plugin["macaddress"].should == "00:AA:BB:CC:DD:EE"
962
+ expect(@plugin["ip6address"]).to eq("3ffe:8888:9999::1")
963
+ expect(@plugin["macaddress"]).to eq("00:AA:BB:CC:DD:EE")
964
964
  end
965
965
  end
966
966
  end
@@ -976,9 +976,9 @@ describe Ohai::System, "Network Plugin" do
976
976
 
977
977
  it "doesn't overwrite {ip,mac,ip6}address" do
978
978
  @plugin.run
979
- @plugin["ipaddress"].should == "10.11.12.13"
980
- @plugin["macaddress"].should == "00:AA:BB:CC:DD:EE"
981
- @plugin["ip6address"].should == "3ffe:8888:9999::1"
979
+ expect(@plugin["ipaddress"]).to eq("10.11.12.13")
980
+ expect(@plugin["macaddress"]).to eq("00:AA:BB:CC:DD:EE")
981
+ expect(@plugin["ip6address"]).to eq("3ffe:8888:9999::1")
982
982
  end
983
983
  end
984
984
 
@@ -992,9 +992,9 @@ describe Ohai::System, "Network Plugin" do
992
992
 
993
993
  it "doesn't overwrite {ip,mac,ip6}address" do
994
994
  @plugin.run
995
- @plugin["ipaddress"].should == "10.11.12.13"
996
- @plugin["macaddress"].should == nil
997
- @plugin["ip6address"].should == "3ffe:8888:9999::1"
995
+ expect(@plugin["ipaddress"]).to eq("10.11.12.13")
996
+ expect(@plugin["macaddress"]).to eq(nil)
997
+ expect(@plugin["ip6address"]).to eq("3ffe:8888:9999::1")
998
998
  end
999
999
  end
1000
1000