summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Kvashenkin <ak@gfoil.ru>2018-09-12 22:36:42 +0300
committerAnton Kvashenkin <ak@gfoil.ru>2018-09-12 22:36:42 +0300
commit0b2ab45c555ec74acf6d63a725d37e475f17e6d8 (patch)
tree3a571ddb72cc1495dcb53257192c9f772c902722
parentca906b51acef0f35b5204c3191fed14dd3fc8a43 (diff)
downloadohai-0b2ab45c555ec74acf6d63a725d37e475f17e6d8.tar.gz
Change rspec unit test for root_group plugin
Signed-off-by: Anton Kvashenkin <anton.jugatsu@gmail.com>
-rw-r--r--spec/unit/plugins/root_group_spec.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/unit/plugins/root_group_spec.rb b/spec/unit/plugins/root_group_spec.rb
index 8289a296..705acd77 100644
--- a/spec/unit/plugins/root_group_spec.rb
+++ b/spec/unit/plugins/root_group_spec.rb
@@ -17,7 +17,6 @@
#
require_relative "../../spec_helper.rb"
-require "ohai/util/win32/group_helper"
describe Ohai::System, "root_group" do
before(:each) do
@@ -78,11 +77,17 @@ describe Ohai::System, "root_group" do
end
describe "windows platform" do
+ before(:each) do
+ allow(WmiLite::Wmi).to receive(:new).and_return(wmi)
+ allow(plugin).to receive(:collect_os).and_return(:windows)
+ end
it "should return the group administrators" do
- allow(@plugin).to receive(:collect_os).and_return(:windows)
- expect(Ohai::Util::Win32::GroupHelper).to receive(:windows_root_group_name).and_return("administrators")
+ expect(wmi)
+ .to receive(:query)
+ .with("select * from Win32_Group where sid like 'S-1-5-32-544' and LocalAccount=True")
+ .and_return("Administrators")
+
@plugin.run
- expect(@plugin[:root_group]).to eq("administrators")
end
end
end