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
@@ -21,24 +21,24 @@ describe Ohai::System, "plugin go" do
21
21
  @plugin = get_plugin("go")
22
22
  @plugin[:languages] = Mash.new
23
23
  @stdout = "go version go1.1.2 darwin/amd64\n"
24
- @plugin.stub(:shell_out).with("go version").and_return(mock_shell_out(0, @stdout, ""))
24
+ allow(@plugin).to receive(:shell_out).with("go version").and_return(mock_shell_out(0, @stdout, ""))
25
25
  end
26
26
 
27
27
  it "should get the go version" do
28
- @plugin.should_receive(:shell_out).with("go version").and_return(mock_shell_out(0, @stdout, ""))
28
+ expect(@plugin).to receive(:shell_out).with("go version").and_return(mock_shell_out(0, @stdout, ""))
29
29
  @plugin.run
30
30
  end
31
31
 
32
32
  it "should set languages[:go][:version]" do
33
33
  @plugin.run
34
- @plugin.languages[:go][:version].should eql("1.1.2")
34
+ expect(@plugin.languages[:go][:version]).to eql("1.1.2")
35
35
  end
36
36
 
37
37
  it "should not set the languages[:go] tree up if go command fails" do
38
38
  @stdout = "go version go1.1.2 darwin/amd64\n"
39
- @plugin.stub(:shell_out).with("go version").and_return(mock_shell_out(1, @stdout, ""))
39
+ allow(@plugin).to receive(:shell_out).with("go version").and_return(mock_shell_out(1, @stdout, ""))
40
40
  @plugin.run
41
- @plugin.languages.should_not have_key(:go)
41
+ expect(@plugin.languages).not_to have_key(:go)
42
42
  end
43
43
 
44
44
  end
@@ -25,23 +25,23 @@ describe Ohai::System, "plugin groovy" do
25
25
  @plugin = get_plugin("groovy")
26
26
  @plugin[:languages] = Mash.new
27
27
  @stdout = "Groovy Version: 1.6.3 JVM: 1.6.0_0\n"
28
- @plugin.stub(:shell_out).with("groovy -v").and_return(mock_shell_out(0, @stdout, ""))
28
+ allow(@plugin).to receive(:shell_out).with("groovy -v").and_return(mock_shell_out(0, @stdout, ""))
29
29
  end
30
30
 
31
31
  it "should get the groovy version from running groovy -v" do
32
- @plugin.should_receive(:shell_out).with("groovy -v").and_return(mock_shell_out(0, @stdout, ""))
32
+ expect(@plugin).to receive(:shell_out).with("groovy -v").and_return(mock_shell_out(0, @stdout, ""))
33
33
  @plugin.run
34
34
  end
35
35
 
36
36
  it "should set languages[:groovy][:version]" do
37
37
  @plugin.run
38
- @plugin.languages[:groovy][:version].should eql("1.6.3")
38
+ expect(@plugin.languages[:groovy][:version]).to eql("1.6.3")
39
39
  end
40
40
 
41
41
  it "should not set the languages[:groovy] tree up if groovy command fails" do
42
- @plugin.stub(:shell_out).with("groovy -v").and_return(mock_shell_out(1, @stdout, ""))
42
+ allow(@plugin).to receive(:shell_out).with("groovy -v").and_return(mock_shell_out(1, @stdout, ""))
43
43
  @plugin.run
44
- @plugin.languages.should_not have_key(:groovy)
44
+ expect(@plugin.languages).not_to have_key(:groovy)
45
45
  end
46
46
 
47
47
  end
@@ -22,95 +22,95 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
22
22
  describe Ohai::System, "hostname plugin" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("hostname")
25
- @plugin.stub(:collect_os).and_return(:default)
26
- @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
25
+ allow(@plugin).to receive(:collect_os).and_return(:default)
26
+ allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
27
27
  end
28
28
 
29
29
  context "when sigar is not installed" do
30
30
  before(:each) do
31
- @plugin.stub(:sigar_is_available?).and_return(false)
32
- @plugin.should_not_receive(:get_fqdn_from_sigar)
33
- @plugin.stub(:resolve_fqdn).and_return("katie.bethell")
31
+ allow(@plugin).to receive(:sigar_is_available?).and_return(false)
32
+ expect(@plugin).not_to receive(:get_fqdn_from_sigar)
33
+ allow(@plugin).to receive(:resolve_fqdn).and_return("katie.bethell")
34
34
  end
35
35
  it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
36
36
 
37
37
  it "should use #resolve_fqdn to find the fqdn" do
38
38
  @plugin.run
39
- @plugin[:fqdn].should == "katie.bethell"
39
+ expect(@plugin[:fqdn]).to eq("katie.bethell")
40
40
  end
41
41
 
42
42
  it "should set the domain to everything after the first dot of the fqdn" do
43
43
  @plugin.run
44
- @plugin[:domain].should == "bethell"
44
+ expect(@plugin[:domain]).to eq("bethell")
45
45
  end
46
46
 
47
47
  it "should set the [short] hostname to everything before the first dot of the fqdn" do
48
48
  @plugin.run
49
- @plugin[:hostname].should == "katie"
49
+ expect(@plugin[:hostname]).to eq("katie")
50
50
  end
51
51
  end
52
52
 
53
53
  context "when sigar is installed" do
54
54
  before(:each) do
55
- @plugin.stub(:sigar_is_available?).and_return(true)
56
- @plugin.stub(:get_fqdn_from_sigar).and_return("katie.bethell")
55
+ allow(@plugin).to receive(:sigar_is_available?).and_return(true)
56
+ allow(@plugin).to receive(:get_fqdn_from_sigar).and_return("katie.bethell")
57
57
  end
58
58
  it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
59
59
  it "should set the fqdn to the returned value from sigar" do
60
60
  @plugin.run
61
- @plugin[:fqdn].should == "katie.bethell"
61
+ expect(@plugin[:fqdn]).to eq("katie.bethell")
62
62
  end
63
63
 
64
64
  it "should set the domain to everything after the first dot of the fqdn" do
65
65
  @plugin.run
66
- @plugin[:domain].should == "bethell"
66
+ expect(@plugin[:domain]).to eq("bethell")
67
67
  end
68
68
 
69
69
  it "should set the [short] hostname to everything before the first dot of the fqdn" do
70
70
  @plugin.run
71
- @plugin[:hostname].should == "katie"
71
+ expect(@plugin[:hostname]).to eq("katie")
72
72
  end
73
73
  end
74
74
 
75
75
  context "when a system has a bare hostname without a FQDN" do
76
76
  before(:each) do
77
- @plugin.stub(:collect_os).and_return(:default)
78
- @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie", ""))
77
+ allow(@plugin).to receive(:collect_os).and_return(:default)
78
+ allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie", ""))
79
79
  end
80
80
 
81
81
  it "should correctly set the [short] hostname" do
82
82
  @plugin.run
83
- @plugin[:hostname].should == "katie"
83
+ expect(@plugin[:hostname]).to eq("katie")
84
84
  end
85
85
  end
86
86
 
87
87
  context "hostname --fqdn when it returns empty string" do
88
88
  before(:each) do
89
- @plugin.stub(:collect_os).and_return(:linux)
90
- @plugin.stub(:shell_out).with("hostname -s").and_return(
89
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
90
+ allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(
91
91
  mock_shell_out(0, "katie", ""))
92
- @plugin.stub(:shell_out).with("hostname --fqdn").and_return(
92
+ allow(@plugin).to receive(:shell_out).with("hostname --fqdn").and_return(
93
93
  mock_shell_out(0, "", ""), mock_shell_out(0, "katie.local", ""))
94
94
  end
95
95
 
96
96
  it "should be called twice" do
97
97
  @plugin.run
98
- @plugin[:fqdn].should == "katie.local"
98
+ expect(@plugin[:fqdn]).to eq("katie.local")
99
99
  end
100
100
  end
101
101
 
102
102
  context "hostname --fqdn when it works" do
103
103
  before(:each) do
104
- @plugin.stub(:collect_os).and_return(:linux)
105
- @plugin.stub(:shell_out).with("hostname -s").and_return(
104
+ allow(@plugin).to receive(:collect_os).and_return(:linux)
105
+ allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(
106
106
  mock_shell_out(0, "katie", ""))
107
- @plugin.stub(:shell_out).with("hostname --fqdn").and_return(
107
+ allow(@plugin).to receive(:shell_out).with("hostname --fqdn").and_return(
108
108
  mock_shell_out(0, "katie.local", ""))
109
109
  end
110
110
 
111
111
  it "should be not be called twice" do
112
112
  @plugin.run
113
- @plugin[:fqdn].should == "katie.local"
113
+ expect(@plugin[:fqdn]).to eq("katie.local")
114
114
  end
115
115
  end
116
116
  end
@@ -21,7 +21,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '/spec_he
21
21
  describe Ohai::System, "Init package" do
22
22
  let(:plugin) {
23
23
  p = get_plugin("init_package")
24
- p.stub(:collect_os).and_return("linux")
24
+ allow(p).to receive(:collect_os).and_return("linux")
25
25
  p
26
26
  }
27
27
 
@@ -30,13 +30,13 @@ describe Ohai::System, "Init package" do
30
30
  let(:proc_1_file) { double(proc_1_file_path, :gets => proc1_content) }
31
31
 
32
32
  before(:each) do
33
- File.stub(:exists?).with(proc_1_file_path).and_return(true)
34
- File.stub(:open).with(proc_1_file_path).and_return(proc_1_file)
33
+ allow(File).to receive(:exists?).with(proc_1_file_path).and_return(true)
34
+ allow(File).to receive(:open).with(proc_1_file_path).and_return(proc_1_file)
35
35
  end
36
36
 
37
37
  it "should set init_package to init" do
38
38
  plugin.run
39
- plugin[:init_package].should == "init"
39
+ expect(plugin[:init_package]).to eq("init")
40
40
  end
41
41
 
42
42
  describe "when init_package is systemd" do
@@ -44,7 +44,7 @@ describe Ohai::System, "Init package" do
44
44
 
45
45
  it "should set init_package to systemd" do
46
46
  plugin.run
47
- plugin[:init_package].should == "systemd"
47
+ expect(plugin[:init_package]).to eq("systemd")
48
48
  end
49
49
  end
50
50
  end
@@ -81,7 +81,7 @@ describe Ohai::System, "plugin ip_scopes" do
81
81
 
82
82
  before do
83
83
  # standin for raising on `require 'ipaddr_extensions'`
84
- plugin[:network][:interfaces].stub(:keys).and_raise(LoadError)
84
+ allow(plugin[:network][:interfaces]).to receive(:keys).and_raise(LoadError)
85
85
  plugin.run
86
86
  end
87
87
 
@@ -28,44 +28,44 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
28
28
  shared_examples_for "when the JRE is installed" do
29
29
  before do
30
30
  @stderr = "java version \"1.5.0_16\"\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)\nJava HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)"
31
- @plugin.stub(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
31
+ allow(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
32
32
  end
33
33
 
34
34
  it "should run java -mx64m -version" do
35
- @plugin.should_receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
35
+ expect(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
36
36
  @plugin.run
37
37
  end
38
38
 
39
39
  it "should set java[:version]" do
40
40
  @plugin.run
41
- @plugin[:languages][:java][:version].should eql("1.5.0_16")
41
+ expect(@plugin[:languages][:java][:version]).to eql("1.5.0_16")
42
42
  end
43
43
 
44
44
  it "should set java[:runtime][:name] to runtime name" do
45
45
  @plugin.run
46
- @plugin[:languages][:java][:runtime][:name].should eql("Java(TM) 2 Runtime Environment, Standard Edition")
46
+ expect(@plugin[:languages][:java][:runtime][:name]).to eql("Java(TM) 2 Runtime Environment, Standard Edition")
47
47
  end
48
48
 
49
49
  it "should set java[:runtime][:build] to runtime build" do
50
50
  @plugin.run
51
- @plugin[:languages][:java][:runtime][:build].should eql("1.5.0_16-b06-284")
51
+ expect(@plugin[:languages][:java][:runtime][:build]).to eql("1.5.0_16-b06-284")
52
52
  end
53
53
 
54
54
  it "should set java[:hotspot][:name] to hotspot name" do
55
55
  @plugin.run
56
- @plugin[:languages][:java][:hotspot][:name].should eql("Java HotSpot(TM) Client VM")
56
+ expect(@plugin[:languages][:java][:hotspot][:name]).to eql("Java HotSpot(TM) Client VM")
57
57
  end
58
58
 
59
59
  it "should set java[:hotspot][:build] to hotspot build" do
60
60
  @plugin.run
61
- @plugin[:languages][:java][:hotspot][:build].should eql("1.5.0_16-133, mixed mode, sharing")
61
+ expect(@plugin[:languages][:java][:hotspot][:build]).to eql("1.5.0_16-133, mixed mode, sharing")
62
62
  end
63
63
 
64
64
  it "should not set the languages[:java] tree up if java command fails" do
65
65
  @stderr = "Some error output here"
66
- @plugin.stub(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(1, "", @stderr))
66
+ allow(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(1, "", @stderr))
67
67
  @plugin.run
68
- @plugin[:languages].should_not have_key(:java)
68
+ expect(@plugin[:languages]).not_to have_key(:java)
69
69
  end
70
70
  end
71
71
 
@@ -73,44 +73,44 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
73
73
 
74
74
  before(:each) do
75
75
  @stderr = "java version \"1.6.0_22\"\nJava(TM) 2 Runtime Environment (build 1.6.0_22-b04)\nJava HotSpot(TM) Server VM (build 17.1-b03, mixed mode)"
76
- @plugin.stub(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
76
+ allow(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
77
77
  end
78
78
 
79
79
  it "should run java -mx64m -version" do
80
- @plugin.should_receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
80
+ expect(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
81
81
  @plugin.run
82
82
  end
83
83
 
84
84
  it "should set java[:version]" do
85
85
  @plugin.run
86
- @plugin[:languages][:java][:version].should eql("1.6.0_22")
86
+ expect(@plugin[:languages][:java][:version]).to eql("1.6.0_22")
87
87
  end
88
88
 
89
89
  it "should set java[:runtime][:name] to runtime name" do
90
90
  @plugin.run
91
- @plugin[:languages][:java][:runtime][:name].should eql("Java(TM) 2 Runtime Environment")
91
+ expect(@plugin[:languages][:java][:runtime][:name]).to eql("Java(TM) 2 Runtime Environment")
92
92
  end
93
93
 
94
94
  it "should set java[:runtime][:build] to runtime build" do
95
95
  @plugin.run
96
- @plugin[:languages][:java][:runtime][:build].should eql("1.6.0_22-b04")
96
+ expect(@plugin[:languages][:java][:runtime][:build]).to eql("1.6.0_22-b04")
97
97
  end
98
98
 
99
99
  it "should set java[:hotspot][:name] to hotspot name" do
100
100
  @plugin.run
101
- @plugin[:languages][:java][:hotspot][:name].should eql("Java HotSpot(TM) Server VM")
101
+ expect(@plugin[:languages][:java][:hotspot][:name]).to eql("Java HotSpot(TM) Server VM")
102
102
  end
103
103
 
104
104
  it "should set java[:hotspot][:build] to hotspot build" do
105
105
  @plugin.run
106
- @plugin[:languages][:java][:hotspot][:build].should eql("17.1-b03, mixed mode")
106
+ expect(@plugin[:languages][:java][:hotspot][:build]).to eql("17.1-b03, mixed mode")
107
107
  end
108
108
 
109
109
  it "should not set the languages[:java] tree up if java command fails" do
110
110
  @stderr = "Some error output here"
111
- @plugin.stub(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
111
+ allow(@plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", @stderr))
112
112
  @plugin.run
113
- @plugin[:languages].should_not have_key(:java)
113
+ expect(@plugin[:languages]).not_to have_key(:java)
114
114
  end
115
115
  end
116
116
 
@@ -133,14 +133,14 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
133
133
  end
134
134
 
135
135
  it "detects that it is on a darwin platform" do
136
- @plugin.should be_on_darwin
136
+ expect(@plugin).to be_on_darwin
137
137
  end
138
138
 
139
139
  context "and real Java is installed" do
140
140
  before do
141
141
  java_home_status = double(Process::Status, :success? => true)
142
142
  java_home_cmd = double(Mixlib::ShellOut, :status => java_home_status)
143
- @plugin.should_receive(:shell_out).with("/usr/libexec/java_home").and_return(java_home_cmd)
143
+ expect(@plugin).to receive(:shell_out).with("/usr/libexec/java_home").and_return(java_home_cmd)
144
144
  end
145
145
 
146
146
  context "and the client JRE is installed" do
@@ -155,13 +155,13 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
155
155
  before do
156
156
  java_home_status = double(Process::Status, :success? => false)
157
157
  java_home_cmd = double(Mixlib::ShellOut, :status => java_home_status)
158
- @plugin.should_receive(:shell_out).with("/usr/libexec/java_home").and_return(java_home_cmd)
158
+ expect(@plugin).to receive(:shell_out).with("/usr/libexec/java_home").and_return(java_home_cmd)
159
159
  end
160
160
 
161
161
  it "does not attempt to get java info" do
162
- @plugin.should_not_receive(:shell_out).with("java -mx64m -version")
162
+ expect(@plugin).not_to receive(:shell_out).with("java -mx64m -version")
163
163
  @plugin.run
164
- @plugin[:languages].should_not have_key(:java)
164
+ expect(@plugin[:languages]).not_to have_key(:java)
165
165
  end
166
166
  end
167
167
  end
@@ -8,25 +8,25 @@ describe Ohai::System, "plugin joyent" do
8
8
 
9
9
  describe "without joyent" do
10
10
  before(:each) do
11
- @plugin.stub(:is_smartos?).and_return(false)
11
+ allow(@plugin).to receive(:is_smartos?).and_return(false)
12
12
  end
13
13
 
14
14
  it "should NOT create joyent" do
15
15
  @plugin.run
16
- @plugin[:joyent].should be_nil
16
+ expect(@plugin[:joyent]).to be_nil
17
17
  end
18
18
  end
19
19
 
20
20
  describe "with joyent" do
21
21
  before(:each) do
22
- @plugin.stub(:is_smartos?).and_return(true)
22
+ allow(@plugin).to receive(:is_smartos?).and_return(true)
23
23
  @plugin[:virtualization] = Mash.new
24
24
  @plugin[:virtualization][:guest_uuid] = "global"
25
25
  end
26
26
 
27
27
  it "should create joyent" do
28
28
  @plugin.run
29
- @plugin[:joyent].should_not be_nil
29
+ expect(@plugin[:joyent]).not_to be_nil
30
30
  end
31
31
 
32
32
  describe "under global zone" do
@@ -35,11 +35,11 @@ describe Ohai::System, "plugin joyent" do
35
35
  end
36
36
 
37
37
  it "should ditect global zone" do
38
- @plugin[:joyent][:sm_uuid].should eql 'global'
38
+ expect(@plugin[:joyent][:sm_uuid]).to eql 'global'
39
39
  end
40
40
 
41
41
  it "should NOT create sm_id" do
42
- @plugin[:joyent][:sm_id].should be_nil
42
+ expect(@plugin[:joyent][:sm_id]).to be_nil
43
43
  end
44
44
  end
45
45
 
@@ -47,26 +47,26 @@ describe Ohai::System, "plugin joyent" do
47
47
  before(:each) do
48
48
  @plugin[:virtualization][:guest_uuid] = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'
49
49
  @plugin[:virtualization][:guest_id] = '30'
50
- @plugin.stub(:collect_product_file).and_return(["Name: Joyent Instance", "Image: base64 13.4.2", "Documentation: http://wiki.joyent.com/jpc2/SmartMachine+Base"])
51
- @plugin.stub(:collect_pkgsrc).and_return('http://pkgsrc.joyent.com/packages/SmartOS/2013Q4/x86_64/All')
50
+ allow(@plugin).to receive(:collect_product_file).and_return(["Name: Joyent Instance", "Image: base64 13.4.2", "Documentation: http://wiki.joyent.com/jpc2/SmartMachine+Base"])
51
+ allow(@plugin).to receive(:collect_pkgsrc).and_return('http://pkgsrc.joyent.com/packages/SmartOS/2013Q4/x86_64/All')
52
52
  @plugin.run
53
53
  end
54
54
 
55
55
  it "should retrive zone uuid" do
56
- @plugin[:joyent][:sm_uuid].should eql 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'
56
+ expect(@plugin[:joyent][:sm_uuid]).to eql 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'
57
57
  end
58
58
 
59
59
  it "should collect sm_id" do
60
- @plugin[:joyent][:sm_id].should eql '30'
60
+ expect(@plugin[:joyent][:sm_id]).to eql '30'
61
61
  end
62
62
 
63
63
  it "should collect images" do
64
- @plugin[:joyent][:sm_image_id].should_not be_nil
65
- @plugin[:joyent][:sm_image_ver].should_not be_nil
64
+ expect(@plugin[:joyent][:sm_image_id]).not_to be_nil
65
+ expect(@plugin[:joyent][:sm_image_ver]).not_to be_nil
66
66
  end
67
67
 
68
68
  it "should collect pkgsrc" do
69
- @plugin[:joyent][:sm_pkgsrc].should eql 'http://pkgsrc.joyent.com/packages/SmartOS/2013Q4/x86_64/All'
69
+ expect(@plugin[:joyent][:sm_pkgsrc]).to eql 'http://pkgsrc.joyent.com/packages/SmartOS/2013Q4/x86_64/All'
70
70
  end
71
71
  end
72
72
  end
@@ -22,12 +22,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
22
22
  describe Ohai::System, "plugin kernel" do
23
23
  before(:each) do
24
24
  @plugin = get_plugin("kernel")
25
- @plugin.stub(:collect_os).and_return(:default) # for debugging
26
- @plugin.stub(:shell_out).with("uname -s").and_return(mock_shell_out(0, "Darwin\n", ""))
27
- @plugin.stub(:shell_out).with("uname -r").and_return(mock_shell_out(0, "9.5.0\n", ""))
28
- @plugin.stub(:shell_out).with("uname -v").and_return(mock_shell_out(0, "Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1\/RELEASE_I386\n", ""))
29
- @plugin.stub(:shell_out).with("uname -m").and_return(mock_shell_out(0, "i386\n", ""))
30
- @plugin.stub(:shell_out).with("uname -o").and_return(mock_shell_out(0, "Linux\n", ""))
25
+ allow(@plugin).to receive(:collect_os).and_return(:default) # for debugging
26
+ allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "Darwin\n", ""))
27
+ allow(@plugin).to receive(:shell_out).with("uname -r").and_return(mock_shell_out(0, "9.5.0\n", ""))
28
+ allow(@plugin).to receive(:shell_out).with("uname -v").and_return(mock_shell_out(0, "Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1\/RELEASE_I386\n", ""))
29
+ allow(@plugin).to receive(:shell_out).with("uname -m").and_return(mock_shell_out(0, "i386\n", ""))
30
+ allow(@plugin).to receive(:shell_out).with("uname -o").and_return(mock_shell_out(0, "Linux\n", ""))
31
31
  end
32
32
 
33
33
  it_should_check_from_mash("kernel", "name", "uname -s", [0, "Darwin\n", ""])
@@ -53,15 +53,15 @@ describe Ohai::System, "plugin kernel" do
53
53
  os = double( "WIN32OLE",
54
54
  :properties_ => os_properties)
55
55
 
56
- os.stub(:invoke).with(build_number.name).and_return('7601')
57
- os.stub(:invoke).with(csd_version.name).and_return('Service Pack 1')
58
- os.stub(:invoke).with(os_type.name).and_return(18)
59
- os.stub(:invoke).with(caption.name).and_return('Microsoft Windows 7 Ultimate')
60
- os.stub(:invoke).with(version.name).and_return('6.1.7601')
56
+ allow(os).to receive(:invoke).with(build_number.name).and_return('7601')
57
+ allow(os).to receive(:invoke).with(csd_version.name).and_return('Service Pack 1')
58
+ allow(os).to receive(:invoke).with(os_type.name).and_return(18)
59
+ allow(os).to receive(:invoke).with(caption.name).and_return('Microsoft Windows 7 Ultimate')
60
+ allow(os).to receive(:invoke).with(version.name).and_return('6.1.7601')
61
61
 
62
62
  os_wmi = WmiLite::Wmi::Instance.new(os)
63
63
 
64
- WmiLite::Wmi.any_instance.should_receive(:first_of).with('Win32_OperatingSystem').and_return(os_wmi)
64
+ expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with('Win32_OperatingSystem').and_return(os_wmi)
65
65
 
66
66
  # Mock a Win32_ComputerSystem OLE32 WMI object
67
67
  x64_system_type = 'x64-based PC'
@@ -69,21 +69,21 @@ describe Ohai::System, "plugin kernel" do
69
69
  cs = double("WIN32OLE",
70
70
  :properties_ => [ double("WIN32OLE", :name => "SystemType") ])
71
71
 
72
- cs.stub(:invoke).with('SystemType').and_return(x64_system_type)
72
+ allow(cs).to receive(:invoke).with('SystemType').and_return(x64_system_type)
73
73
 
74
74
  cs_wmi = WmiLite::Wmi::Instance.new(cs)
75
75
 
76
- WmiLite::Wmi.any_instance.should_receive(:first_of).with('Win32_ComputerSystem').and_return(cs_wmi)
77
- WmiLite::Wmi.any_instance.should_receive(:instances_of).with('Win32_PnPSignedDriver').and_return([])
76
+ expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with('Win32_ComputerSystem').and_return(cs_wmi)
77
+ expect_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with('Win32_PnPSignedDriver').and_return([])
78
78
 
79
79
  @plugin.run
80
80
  end
81
81
  it "should set the corrent system information" do
82
- @ohai_system.data[:kernel][:name].should == "Microsoft Windows 7 Ultimate"
83
- @ohai_system.data[:kernel][:release].should == "6.1.7601"
84
- @ohai_system.data[:kernel][:version].should == "6.1.7601 Service Pack 1 Build 7601"
85
- @ohai_system.data[:kernel][:os].should == "WINNT"
86
- @ohai_system.data[:kernel][:machine].should == "x86_64"
82
+ expect(@ohai_system.data[:kernel][:name]).to eq("Microsoft Windows 7 Ultimate")
83
+ expect(@ohai_system.data[:kernel][:release]).to eq("6.1.7601")
84
+ expect(@ohai_system.data[:kernel][:version]).to eq("6.1.7601 Service Pack 1 Build 7601")
85
+ expect(@ohai_system.data[:kernel][:os]).to eq("WINNT")
86
+ expect(@ohai_system.data[:kernel][:machine]).to eq("x86_64")
87
87
  end
88
88
  end
89
89