ohai 15.2.5 → 15.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ohai/application.rb +2 -2
  3. data/lib/ohai/mixin/dmi_decode.rb +4 -1
  4. data/lib/ohai/plugins/linux/sysctl.rb +38 -0
  5. data/lib/ohai/plugins/linux/virtualization.rb +11 -10
  6. data/lib/ohai/plugins/openstack.rb +8 -3
  7. data/lib/ohai/plugins/passwd.rb +4 -0
  8. data/lib/ohai/version.rb +1 -1
  9. data/spec/functional/application_spec.rb +5 -5
  10. data/spec/functional/loader_spec.rb +2 -2
  11. data/spec/functional/plugins/powershell_spec.rb +11 -5
  12. data/spec/functional/plugins/root_group_spec.rb +1 -1
  13. data/spec/functional/plugins/windows/uptime_spec.rb +3 -3
  14. data/spec/ohai_spec.rb +1 -1
  15. data/spec/spec_helper.rb +8 -8
  16. data/spec/support/integration_helper.rb +3 -3
  17. data/spec/unit/application_spec.rb +5 -5
  18. data/spec/unit/dsl/plugin_spec.rb +8 -7
  19. data/spec/unit/mixin/command_spec.rb +2 -2
  20. data/spec/unit/mixin/dmi_decode.rb +8 -1
  21. data/spec/unit/plugins/abort_spec.rb +4 -4
  22. data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
  23. data/spec/unit/plugins/aix/filesystem_spec.rb +1 -1
  24. data/spec/unit/plugins/aix/hostname_spec.rb +2 -2
  25. data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
  26. data/spec/unit/plugins/aix/memory_spec.rb +5 -5
  27. data/spec/unit/plugins/aix/network_spec.rb +4 -1
  28. data/spec/unit/plugins/aix/platform_spec.rb +4 -4
  29. data/spec/unit/plugins/aix/uptime_spec.rb +3 -3
  30. data/spec/unit/plugins/aix/virtualization_spec.rb +1 -1
  31. data/spec/unit/plugins/azure_spec.rb +8 -8
  32. data/spec/unit/plugins/bsd/filesystem_spec.rb +17 -16
  33. data/spec/unit/plugins/bsd/virtualization_spec.rb +1 -1
  34. data/spec/unit/plugins/c_spec.rb +6 -5
  35. data/spec/unit/plugins/chef_spec.rb +2 -2
  36. data/spec/unit/plugins/cloud_spec.rb +4 -4
  37. data/spec/unit/plugins/darwin/cpu_spec.rb +11 -11
  38. data/spec/unit/plugins/darwin/filesystem_spec.rb +14 -13
  39. data/spec/unit/plugins/darwin/hardware_spec.rb +2 -1
  40. data/spec/unit/plugins/darwin/hostname_spec.rb +3 -3
  41. data/spec/unit/plugins/darwin/kernel_spec.rb +5 -5
  42. data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
  43. data/spec/unit/plugins/darwin/network_spec.rb +3 -3
  44. data/spec/unit/plugins/darwin/platform_spec.rb +9 -9
  45. data/spec/unit/plugins/darwin/virtualization_spec.rb +10 -10
  46. data/spec/unit/plugins/digital_ocean_spec.rb +14 -12
  47. data/spec/unit/plugins/dmi_spec.rb +1 -1
  48. data/spec/unit/plugins/docker_spec.rb +2 -2
  49. data/spec/unit/plugins/ec2_spec.rb +41 -30
  50. data/spec/unit/plugins/elixir_spec.rb +2 -2
  51. data/spec/unit/plugins/erlang_spec.rb +1 -1
  52. data/spec/unit/plugins/eucalyptus_spec.rb +17 -13
  53. data/spec/unit/plugins/fail_spec.rb +15 -15
  54. data/spec/unit/plugins/freebsd/cpu_spec.rb +2 -2
  55. data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
  56. data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -2
  57. data/spec/unit/plugins/freebsd/platform_spec.rb +3 -3
  58. data/spec/unit/plugins/gce_spec.rb +9 -7
  59. data/spec/unit/plugins/go_spec.rb +2 -2
  60. data/spec/unit/plugins/groovy_spec.rb +1 -1
  61. data/spec/unit/plugins/haskell_spec.rb +10 -10
  62. data/spec/unit/plugins/hostname_spec.rb +15 -14
  63. data/spec/unit/plugins/init_package_spec.rb +4 -4
  64. data/spec/unit/plugins/java_spec.rb +7 -3
  65. data/spec/unit/plugins/joyent_spec.rb +4 -4
  66. data/spec/unit/plugins/kernel_spec.rb +1 -1
  67. data/spec/unit/plugins/linux/block_device_spec.rb +2 -2
  68. data/spec/unit/plugins/linux/cpu_spec.rb +9 -8
  69. data/spec/unit/plugins/linux/filesystem_spec.rb +36 -35
  70. data/spec/unit/plugins/linux/fips_spec.rb +7 -5
  71. data/spec/unit/plugins/linux/hostname_spec.rb +4 -4
  72. data/spec/unit/plugins/linux/hostnamectl_spec.rb +3 -3
  73. data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
  74. data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
  75. data/spec/unit/plugins/linux/lspci_spec.rb +2 -1
  76. data/spec/unit/plugins/linux/machineid_spec.rb +3 -3
  77. data/spec/unit/plugins/linux/mdadm_spec.rb +13 -13
  78. data/spec/unit/plugins/linux/memory_spec.rb +39 -39
  79. data/spec/unit/plugins/linux/network_spec.rb +20 -19
  80. data/spec/unit/plugins/linux/platform_spec.rb +60 -57
  81. data/spec/unit/plugins/linux/sessions_spec.rb +3 -3
  82. data/spec/unit/plugins/linux/sysctl_spec.rb +53 -0
  83. data/spec/unit/plugins/linux/systemd_paths_spec.rb +3 -3
  84. data/spec/unit/plugins/linux/uptime_spec.rb +5 -5
  85. data/spec/unit/plugins/linux/virtualization_spec.rb +4 -4
  86. data/spec/unit/plugins/lua_spec.rb +1 -1
  87. data/spec/unit/plugins/mono_spec.rb +1 -1
  88. data/spec/unit/plugins/netbsd/hostname_spec.rb +3 -3
  89. data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
  90. data/spec/unit/plugins/netbsd/platform_spec.rb +3 -3
  91. data/spec/unit/plugins/network_spec.rb +3 -3
  92. data/spec/unit/plugins/nodejs_spec.rb +1 -1
  93. data/spec/unit/plugins/ohai_spec.rb +2 -2
  94. data/spec/unit/plugins/ohai_time_spec.rb +4 -4
  95. data/spec/unit/plugins/openbsd/hostname_spec.rb +3 -3
  96. data/spec/unit/plugins/openbsd/kernel_spec.rb +2 -2
  97. data/spec/unit/plugins/openbsd/platform_spec.rb +2 -2
  98. data/spec/unit/plugins/openstack_spec.rb +13 -8
  99. data/spec/unit/plugins/os_spec.rb +12 -12
  100. data/spec/unit/plugins/packages_spec.rb +10 -7
  101. data/spec/unit/plugins/passwd_spec.rb +18 -19
  102. data/spec/unit/plugins/perl_spec.rb +1 -1
  103. data/spec/unit/plugins/php_spec.rb +1 -1
  104. data/spec/unit/plugins/platform_spec.rb +7 -7
  105. data/spec/unit/plugins/powershell_spec.rb +1 -1
  106. data/spec/unit/plugins/rackspace_spec.rb +25 -20
  107. data/spec/unit/plugins/root_group_spec.rb +14 -10
  108. data/spec/unit/plugins/ruby_spec.rb +2 -2
  109. data/spec/unit/plugins/rust_spec.rb +3 -3
  110. data/spec/unit/plugins/scala_spec.rb +2 -2
  111. data/spec/unit/plugins/scaleway_spec.rb +14 -12
  112. data/spec/unit/plugins/scsi_spec.rb +2 -1
  113. data/spec/unit/plugins/shard_spec.rb +18 -16
  114. data/spec/unit/plugins/solaris2/cpu_spec.rb +29 -29
  115. data/spec/unit/plugins/solaris2/dmi_spec.rb +4 -4
  116. data/spec/unit/plugins/solaris2/filesystem.rb +3 -3
  117. data/spec/unit/plugins/solaris2/hostname_spec.rb +2 -2
  118. data/spec/unit/plugins/solaris2/kernel_spec.rb +4 -4
  119. data/spec/unit/plugins/solaris2/memory_spec.rb +4 -4
  120. data/spec/unit/plugins/solaris2/platform_spec.rb +9 -9
  121. data/spec/unit/plugins/solaris2/virtualization_spec.rb +6 -6
  122. data/spec/unit/plugins/ssh_host_keys_spec.rb +4 -1
  123. data/spec/unit/plugins/sysconf_spec.rb +2 -2
  124. data/spec/unit/plugins/timezone_spec.rb +2 -2
  125. data/spec/unit/plugins/virtualbox_spec.rb +10 -10
  126. data/spec/unit/plugins/vmware_spec.rb +4 -4
  127. data/spec/unit/plugins/windows/cpu_spec.rb +13 -13
  128. data/spec/unit/plugins/windows/filesystem_spec.rb +1 -1
  129. data/spec/unit/plugins/windows/fips_spec.rb +7 -5
  130. data/spec/unit/plugins/windows/kernel_spec.rb +1 -1
  131. data/spec/unit/plugins/windows/memory_spec.rb +4 -4
  132. data/spec/unit/plugins/windows/network_spec.rb +1 -1
  133. data/spec/unit/plugins/windows/system_enclosure_spec.rb +2 -2
  134. data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
  135. data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
  136. data/spec/unit/plugins/zpools_spec.rb +2 -0
  137. data/spec/unit/provides_map_spec.rb +18 -18
  138. data/spec/unit/runner_spec.rb +29 -29
  139. data/spec/unit/system_spec.rb +13 -13
  140. data/spec/unit/util/file_helper_spec.rb +1 -1
  141. data/spec/unit/util/ip_helper_spec.rb +6 -6
  142. metadata +4 -2
@@ -19,7 +19,7 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
22
- before(:each) do
22
+ before do
23
23
  @plugin = get_plugin("cpu")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
25
25
  @double_file = double("/var/run/dmesg.boot")
@@ -94,7 +94,7 @@ describe Ohai::System, "FreeBSD cpu plugin on FreeBSD >=10.2" do
94
94
  end
95
95
 
96
96
  describe Ohai::System, "FreeBSD cpu plugin on FreeBSD <=10.1" do
97
- before(:each) do
97
+ before do
98
98
  @plugin = get_plugin("cpu")
99
99
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
100
100
  allow(@plugin).to receive(:shell_out).with("sysctl -n hw.ncpu").and_return(mock_shell_out(0, "2", ""))
@@ -19,7 +19,7 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "FreeBSD hostname plugin" do
22
- before(:each) do
22
+ before do
23
23
  @plugin = get_plugin("hostname")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
25
25
  allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
@@ -19,7 +19,7 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "FreeBSD kernel plugin" do
22
- before(:each) do
22
+ before do
23
23
  @plugin = get_plugin("kernel")
24
24
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
25
25
  allow(@plugin).to receive(:init_kernel).and_return({ name: "freebsd" })
@@ -28,7 +28,7 @@ describe Ohai::System, "FreeBSD kernel plugin" do
28
28
  allow(@plugin).to receive(:shell_out).with( Ohai.abs_path( "/sbin/kldstat" )).and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
29
29
  end
30
30
 
31
- it "should set the kernel_os to the kernel_name value" do
31
+ it "sets the kernel_os to the kernel_name value" do
32
32
  @plugin.run
33
33
  expect(@plugin[:kernel][:os]).to eq(@plugin[:kernel][:name])
34
34
  end
@@ -19,19 +19,19 @@
19
19
  require "spec_helper"
20
20
 
21
21
  describe Ohai::System, "FreeBSD plugin platform" do
22
- before(:each) do
22
+ before do
23
23
  @plugin = get_plugin("freebsd/platform")
24
24
  allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "FreeBSD\n", ""))
25
25
  allow(@plugin).to receive(:shell_out).with("uname -r").and_return(mock_shell_out(0, "7.1\n", ""))
26
26
  allow(@plugin).to receive(:collect_os).and_return(:freebsd)
27
27
  end
28
28
 
29
- it "should set platform to lowercased lsb[:id]" do
29
+ it "sets platform to lowercased lsb[:id]" do
30
30
  @plugin.run
31
31
  expect(@plugin[:platform]).to eq("freebsd")
32
32
  end
33
33
 
34
- it "should set platform_version to lsb[:release]" do
34
+ it "sets platform_version to lsb[:release]" do
35
35
  @plugin.run
36
36
  expect(@plugin[:platform_version]).to eq("7.1")
37
37
  end
@@ -34,7 +34,7 @@ describe Ohai::System, "plugin gce" do
34
34
  end
35
35
 
36
36
  shared_examples_for "gce" do
37
- before(:each) do
37
+ before do
38
38
  @http_get = double("Net::HTTP client")
39
39
  allow(plugin).to receive(:http_get).and_return(double("Net::HTTP Response", body: '{"instance":{"hostname":"test-host"}}', code: "200"))
40
40
  allow(IO).to receive(:select).and_return([[], [1], []])
@@ -54,17 +54,16 @@ describe Ohai::System, "plugin gce" do
54
54
  end
55
55
 
56
56
  describe "with hint file and with metadata connection" do
57
- it_behaves_like "gce"
58
-
59
- before(:each) do
57
+ before do
60
58
  allow(plugin).to receive(:hint?).with("gce").and_return({})
61
59
  end
60
+
61
+ it_behaves_like "gce"
62
+
62
63
  end
63
64
 
64
65
  describe "without hint file and without metadata connection" do
65
- it_behaves_like "!gce"
66
-
67
- before(:each) do
66
+ before do
68
67
  allow(plugin).to receive(:hint?).with("gce").and_return(false)
69
68
 
70
69
  # Raise Errno::ENOENT to simulate the scenario in which metadata server
@@ -74,6 +73,9 @@ describe Ohai::System, "plugin gce" do
74
73
  allow(Socket).to receive(:new).and_return(t)
75
74
  allow(Socket).to receive(:pack_sockaddr_in).and_return(nil)
76
75
  end
76
+
77
+ it_behaves_like "!gce"
78
+
77
79
  end
78
80
 
79
81
  end
@@ -18,13 +18,13 @@ require "spec_helper"
18
18
  describe Ohai::System, "plugin go" do
19
19
  let(:plugin) { get_plugin("go") }
20
20
 
21
- before(:each) do
21
+ before do
22
22
  plugin[:languages] = Mash.new
23
23
  stdout = "go version go1.6.1 darwin/amd64\n"
24
24
  allow(plugin).to receive(:shell_out).with("go version").and_return(mock_shell_out(0, stdout, ""))
25
25
  end
26
26
 
27
- it "it shells out to get the go version" do
27
+ it "shells out to get the go version" do
28
28
  expect(plugin).to receive(:shell_out).with("go version")
29
29
  plugin.run
30
30
  end
@@ -21,7 +21,7 @@ require "spec_helper"
21
21
  describe Ohai::System, "plugin groovy" do
22
22
  let(:plugin) { get_plugin("groovy") }
23
23
 
24
- before(:each) do
24
+ before do
25
25
  plugin[:languages] = Mash.new
26
26
  end
27
27
 
@@ -47,7 +47,7 @@ describe Ohai::System, "plugin haskell" do
47
47
 
48
48
  context "if haskell/ghc is installed" do
49
49
 
50
- before(:each) do
50
+ before do
51
51
  setup_plugin
52
52
  plugin.run
53
53
  end
@@ -63,7 +63,7 @@ describe Ohai::System, "plugin haskell" do
63
63
 
64
64
  context "if haskell/ghci is installed" do
65
65
 
66
- before(:each) do
66
+ before do
67
67
  setup_plugin
68
68
  plugin.run
69
69
  end
@@ -79,7 +79,7 @@ describe Ohai::System, "plugin haskell" do
79
79
 
80
80
  context "if haskell/cabal is installed" do
81
81
 
82
- before(:each) do
82
+ before do
83
83
  setup_plugin
84
84
  plugin.run
85
85
  end
@@ -95,7 +95,7 @@ describe Ohai::System, "plugin haskell" do
95
95
 
96
96
  context "if haskell/stack is installed" do
97
97
 
98
- before(:each) do
98
+ before do
99
99
  setup_plugin
100
100
  plugin.run
101
101
  end
@@ -111,7 +111,7 @@ describe Ohai::System, "plugin haskell" do
111
111
 
112
112
  context "if haskell/stack prerelease is installed" do
113
113
 
114
- before(:each) do
114
+ before do
115
115
  setup_plugin
116
116
  allow(plugin).to receive(:shell_out)
117
117
  .with("stack --version")
@@ -130,7 +130,7 @@ describe Ohai::System, "plugin haskell" do
130
130
 
131
131
  context "if haskell is NOT installed" do
132
132
 
133
- before(:each) do
133
+ before do
134
134
  allow(plugin).to receive(:shell_out)
135
135
  .and_raise( Ohai::Exceptions::Exec )
136
136
  plugin.run
@@ -142,7 +142,7 @@ describe Ohai::System, "plugin haskell" do
142
142
  end
143
143
 
144
144
  context "if haskell/ghc is NOT installed" do
145
- before(:each) do
145
+ before do
146
146
  allow(plugin).to receive(:shell_out)
147
147
  .with("ghc --version")
148
148
  .and_raise( Ohai::Exceptions::Exec )
@@ -164,7 +164,7 @@ describe Ohai::System, "plugin haskell" do
164
164
  end
165
165
 
166
166
  context "if haskell/ghci is NOT installed" do
167
- before(:each) do
167
+ before do
168
168
  allow(plugin).to receive(:shell_out)
169
169
  .with("ghc --version")
170
170
  .and_return(mock_shell_out(0, ghc_out, ""))
@@ -186,7 +186,7 @@ describe Ohai::System, "plugin haskell" do
186
186
  end
187
187
 
188
188
  context "if haskell/cabal is NOT installed" do
189
- before(:each) do
189
+ before do
190
190
  allow(plugin).to receive(:shell_out)
191
191
  .with("ghc --version")
192
192
  .and_return(mock_shell_out(0, ghc_out, ""))
@@ -208,7 +208,7 @@ describe Ohai::System, "plugin haskell" do
208
208
  end
209
209
 
210
210
  context "if haskell/stack is NOT installed" do
211
- before(:each) do
211
+ before do
212
212
  allow(plugin).to receive(:shell_out)
213
213
  .with("ghc --version")
214
214
  .and_return(mock_shell_out(0, ghc_out, ""))
@@ -21,47 +21,48 @@ require "wmi-lite/wmi"
21
21
  require "socket"
22
22
 
23
23
  describe Ohai::System, "hostname plugin" do
24
- before(:each) do
24
+ before do
25
25
  @plugin = get_plugin("hostname")
26
26
  allow(@plugin).to receive(:collect_os).and_return(:default)
27
27
  allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
28
28
  end
29
29
 
30
30
  context "default behavior"
31
- before(:each) do
31
+ before do
32
32
  allow(@plugin).to receive(:resolve_fqdn).and_return("katie.bethell")
33
33
  end
34
+
34
35
  it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
35
36
 
36
- it "should use #resolve_fqdn to find the fqdn" do
37
+ it "uses #resolve_fqdn to find the fqdn" do
37
38
  @plugin.run
38
39
  expect(@plugin[:fqdn]).to eq("katie.bethell")
39
40
  end
40
41
 
41
- it "should set the domain to everything after the first dot of the fqdn" do
42
+ it "sets the domain to everything after the first dot of the fqdn" do
42
43
  @plugin.run
43
44
  expect(@plugin[:domain]).to eq("bethell")
44
45
  end
45
46
 
46
- it "should set the [short] hostname to everything before the first dot of the fqdn" do
47
+ it "sets the [short] hostname to everything before the first dot of the fqdn" do
47
48
  @plugin.run
48
49
  expect(@plugin[:hostname]).to eq("katie")
49
50
  end
50
51
 
51
52
  context "when a system has a bare hostname without a FQDN" do
52
- before(:each) do
53
+ before do
53
54
  allow(@plugin).to receive(:collect_os).and_return(:default)
54
55
  allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie", ""))
55
56
  end
56
57
 
57
- it "should correctly set the [short] hostname" do
58
+ it "correctlies set the [short] hostname" do
58
59
  @plugin.run
59
60
  expect(@plugin[:hostname]).to eq("katie")
60
61
  end
61
62
  end
62
63
 
63
64
  context "hostname --fqdn when it returns empty string" do
64
- before(:each) do
65
+ before do
65
66
  allow(@plugin).to receive(:collect_os).and_return(:linux)
66
67
  allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(
67
68
  mock_shell_out(0, "katie", "")
@@ -71,14 +72,14 @@ describe Ohai::System, "hostname plugin" do
71
72
  )
72
73
  end
73
74
 
74
- it "should be called twice" do
75
+ it "is called twice" do
75
76
  @plugin.run
76
77
  expect(@plugin[:fqdn]).to eq("katie.local")
77
78
  end
78
79
  end
79
80
 
80
81
  context "hostname --fqdn when it works" do
81
- before(:each) do
82
+ before do
82
83
  allow(@plugin).to receive(:collect_os).and_return(:linux)
83
84
  allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(
84
85
  mock_shell_out(0, "katie", "")
@@ -88,7 +89,7 @@ describe Ohai::System, "hostname plugin" do
88
89
  )
89
90
  end
90
91
 
91
- it "should be not be called twice" do
92
+ it "is not be called twice" do
92
93
  @plugin.run
93
94
  expect(@plugin[:fqdn]).to eq("katie.local")
94
95
  end
@@ -135,7 +136,7 @@ describe Ohai::System, "hostname plugin for windows", :windows_only do
135
136
  ]
136
137
  end
137
138
 
138
- before(:each) do
139
+ before do
139
140
  @plugin = get_plugin("hostname")
140
141
  allow(WmiLite::Wmi).to receive(:new).and_return(success)
141
142
  allow(success).to receive(:first_of).with("Win32_ComputerSystem").and_return(host)
@@ -144,7 +145,7 @@ describe Ohai::System, "hostname plugin for windows", :windows_only do
144
145
  end
145
146
 
146
147
  context "when hostname is not set for the machine" do
147
- it "should return short machine name" do
148
+ it "returns short machine name" do
148
149
  allow(Socket).to receive(:gethostbyaddr).with(anything).and_return(local_hostent)
149
150
  @plugin.run
150
151
  expect(@plugin[:fqdn]).to eq("local")
@@ -152,7 +153,7 @@ describe Ohai::System, "hostname plugin for windows", :windows_only do
152
153
  end
153
154
 
154
155
  context "when hostname is set for the machine" do
155
- it "should return the fqdn of the machine" do
156
+ it "returns the fqdn of the machine" do
156
157
  allow(Socket).to receive(:gethostbyaddr).with(anything).and_return(fqdn_hostent)
157
158
  @plugin.run
158
159
  expect(@plugin[:fqdn]).to eq("local.dx.internal.cloudapp.net")
@@ -30,12 +30,12 @@ describe Ohai::System, "Init package" do
30
30
  let(:proc_1_file_path) { "/proc/1/comm" }
31
31
  let(:proc_1_file) { double(proc_1_file_path, gets: proc1_content) }
32
32
 
33
- before(:each) do
33
+ before do
34
34
  allow(File).to receive(:exist?).with(proc_1_file_path).and_return(proc1_exists)
35
35
  allow(File).to receive(:open).with(proc_1_file_path).and_return(proc_1_file)
36
36
  end
37
37
 
38
- it "should set init_package to init" do
38
+ it "sets init_package to init" do
39
39
  plugin.run
40
40
  expect(plugin[:init_package]).to eq("init")
41
41
  end
@@ -43,7 +43,7 @@ describe Ohai::System, "Init package" do
43
43
  describe "when init_package is systemd" do
44
44
  let(:proc1_content) { "systemd\n" }
45
45
 
46
- it "should set init_package to systemd" do
46
+ it "sets init_package to systemd" do
47
47
  plugin.run
48
48
  expect(plugin[:init_package]).to eq("systemd")
49
49
  end
@@ -52,7 +52,7 @@ describe Ohai::System, "Init package" do
52
52
  describe "when /proc/1/comm doesn't exist" do
53
53
  let(:proc1_exists) { false }
54
54
 
55
- it "should set init_package to init" do
55
+ it "sets init_package to init" do
56
56
  plugin.run
57
57
  expect(plugin[:init_package]).to eq("init")
58
58
  end
@@ -22,7 +22,7 @@ require "spec_helper"
22
22
  describe Ohai::System, "plugin java (Java5 Client VM)" do
23
23
  let(:plugin) { get_plugin("java") }
24
24
 
25
- before(:each) do
25
+ before do
26
26
  plugin[:languages] = Mash.new
27
27
  end
28
28
 
@@ -78,7 +78,7 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
78
78
 
79
79
  shared_examples_for "when the Server JRE is installed" do
80
80
 
81
- before(:each) do
81
+ before do
82
82
  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)"
83
83
  allow(plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", stderr))
84
84
  end
@@ -123,7 +123,7 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
123
123
 
124
124
  shared_examples_for "when the openjdk 1.8 is installed" do
125
125
 
126
- before(:each) do
126
+ before do
127
127
  stderr = "openjdk version \"1.8.0_71\"\nOpenJDK Runtime Environment (build 1.8.0_71-b15)\nOpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)"
128
128
  allow(plugin).to receive(:shell_out).with("java -mx64m -version").and_return(mock_shell_out(0, "", stderr))
129
129
  end
@@ -174,9 +174,11 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
174
174
  context "and the client JRE is installed" do
175
175
  include_examples "when the JRE is installed"
176
176
  end
177
+
177
178
  context "and the server JRE is installed" do
178
179
  include_examples "when the Server JRE is installed"
179
180
  end
181
+
180
182
  context "and the openjdk 1.8 is installed" do
181
183
  include_examples "when the openjdk 1.8 is installed"
182
184
  end
@@ -201,9 +203,11 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
201
203
  context "and the client JRE is installed" do
202
204
  include_examples "when the JRE is installed"
203
205
  end
206
+
204
207
  context "and the server JRE is installed" do
205
208
  include_examples "when the Server JRE is installed"
206
209
  end
210
+
207
211
  context "and the openjdk 1.8 is installed" do
208
212
  include_examples "when the openjdk 1.8 is installed"
209
213
  end
@@ -20,7 +20,7 @@ describe Ohai::System, "plugin joyent" do
20
20
  let(:plugin) { get_plugin("joyent") }
21
21
 
22
22
  describe "without joyent" do
23
- before(:each) do
23
+ before do
24
24
  allow(plugin).to receive(:is_smartos?).and_return(false)
25
25
  end
26
26
 
@@ -31,7 +31,7 @@ describe Ohai::System, "plugin joyent" do
31
31
  end
32
32
 
33
33
  describe "with joyent" do
34
- before(:each) do
34
+ before do
35
35
  allow(plugin).to receive(:is_smartos?).and_return(true)
36
36
  plugin[:virtualization] = Mash.new
37
37
  plugin[:virtualization][:guest_uuid] = "global"
@@ -43,7 +43,7 @@ describe Ohai::System, "plugin joyent" do
43
43
  end
44
44
 
45
45
  describe "under global zone" do
46
- before(:each) do
46
+ before do
47
47
  plugin.run
48
48
  end
49
49
 
@@ -57,7 +57,7 @@ describe Ohai::System, "plugin joyent" do
57
57
  end
58
58
 
59
59
  describe "under smartmachine" do
60
- before(:each) do
60
+ before do
61
61
  plugin[:virtualization][:guest_uuid] = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
62
62
  plugin[:virtualization][:guest_id] = "30"
63
63