Try to appease Code Climate

I...I don't know how to make it better.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This commit is contained in:
Jerry Aldrich 2019-07-01 22:39:12 -07:00
parent 668b8d82bf
commit dafa4f4165

View file

@ -3,30 +3,26 @@ require "inspec/resource"
require "inspec/resources/windows_task"
describe "Inspec::Resources::WindowsTasks" do
def assert_windows_task_parsing(task_name)
resource = MockLoader.new(:windows).load_resource("windows_task", task_name)
_(resource.to_s).must_equal "Windows Task '#{task_name}'"
_(resource.enabled?).must_equal true
_(resource.disabled?).must_equal false
_(resource.logon_mode).must_equal "Interactive/Background"
_(resource.last_result).must_equal "1056"
_(resource.task_to_run).must_equal '%windir%\\system32\\sc.exe start w32time task_started'
_(resource.run_as_user).must_equal "LOCAL SERVICE"
_(resource.type).must_equal "windows-task"
end
it "can handle a Windows task that does not exist" do
resource_fail = MockLoader.new(:windows).load_resource("windows_task", "does-not-exist")
_(resource_fail.exists?).must_equal false
end
it "parses a windows task with one trigger correctly" do
resource = MockLoader.new(:windows).load_resource("windows_task", "WeLovePizza")
_(resource.enabled?).must_equal true
_(resource.disabled?).must_equal false
_(resource.logon_mode).must_equal "Interactive/Background"
_(resource.last_result).must_equal "1056"
_(resource.task_to_run).must_equal '%windir%\\system32\\sc.exe start w32time task_started'
_(resource.run_as_user).must_equal "LOCAL SERVICE"
_(resource.type).must_equal "windows-task"
_(resource.to_s).must_equal "Windows Task 'WeLovePizza'"
end
it "parses a windows task with more than one trigger correctly" do
resource = MockLoader.new(:windows).load_resource("windows_task", "WeLoveMultiplePizzas")
_(resource.enabled?).must_equal true
_(resource.disabled?).must_equal false
_(resource.logon_mode).must_equal "Interactive/Background"
_(resource.last_result).must_equal "1056"
_(resource.task_to_run).must_equal '%windir%\\system32\\sc.exe start w32time task_started'
_(resource.run_as_user).must_equal "LOCAL SERVICE"
_(resource.type).must_equal "windows-task"
_(resource.to_s).must_equal "Windows Task 'WeLoveMultiplePizzas'"
%w(WeLovePizza WeLoveMultiplePizzas).each do |task_name|
it 'parses a Windows task correctly regardless of the number of triggers' do
assert_windows_task_parsing(task_name)
end
end
end