diff --git a/test/helper.rb b/test/helper.rb index d35bb5f50..e90a70171 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -179,6 +179,8 @@ class MockLoader '/etc/init/ssh.conf' => mockfile.call('upstart_ssh_enabled.conf'), '/etc/hosts.allow' => mockfile.call('hosts.allow'), '/etc/hosts.deny' => mockfile.call('hosts.deny'), + '/fakepath/fakefile' => emptyfile.call, + 'C:/fakepath/fakefile' => emptyfile.call, } # create all mock commands @@ -194,6 +196,18 @@ class MockLoader cmd_exit_1 = mock.mock_command('', '', '', 1) mock.commands = { + '' => empty.call, + 'sh -c \'find /no/such/mock -type f -maxdepth 1\'' => empty.call, + 'type "brew"' => empty.call, + 'bash -c \'type "pip"\'' => empty.call, + 'bash -c \'type "/test/path/pip"\'' => empty.call, + 'type "netstat"' => empty.call, + 'sh -c \'find /etc/apache2/ports.conf -type l -maxdepth 1\'' => empty.call, + 'sh -c \'find /etc/httpd/conf.d/*.conf -type l -maxdepth 1\'' => empty.call, + 'sh -c \'find /etc/httpd/mods-enabled/*.conf -type l -maxdepth 1\'' => empty.call, + 'sh -c \'find /etc/httpd/conf-enabled/*.conf -type f -maxdepth 1\'' => empty.call, + 'find /sys/class/net/eth1/ -maxdepth 1 -type f -exec sh -c \'echo "[$(basename {})]"; cat {} || echo -n\' \;' => empty.call, + 'Get-Package -Name \'Not available\' | ConvertTo-Json' => empty.call, 'ps axo pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user,command' => cmd.call('ps-axo'), 'ps axo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command' => cmd.call('ps-axoZ'), 'ps -o pid,vsz,rss,tty,stat,time,ruser,args' => cmd.call('ps-busybox'), diff --git a/test/unit/resources/windows_feature.rb b/test/unit/resources/windows_feature_test.rb similarity index 100% rename from test/unit/resources/windows_feature.rb rename to test/unit/resources/windows_feature_test.rb diff --git a/test/unit/shell_detector_test.rb b/test/unit/shell_detector_test.rb index 1c5d25acb..81dce10d1 100644 --- a/test/unit/shell_detector_test.rb +++ b/test/unit/shell_detector_test.rb @@ -41,7 +41,7 @@ describe Inspec::ShellDetector do # Small hack to ensure we can test on windows it "returns nil immediately if running on windows" do RbConfig::CONFIG.expects(:[]).with('host_os').returns('mswin') - subject.shell!.must_equal(nil) + subject.shell!.must_be_nil end describe "not on windows" do @@ -72,7 +72,7 @@ describe Inspec::ShellDetector do it "returns nil if the shell isn't in the whitelist" do no_proc; with_ps(""); with_env("badshell"); with_pwuid("/usr/bin/badshell") - subject.shell!.must_equal(nil) + subject.shell!.must_be_nil end end end diff --git a/test/unit/utils/solaris_netstat_parser.rb b/test/unit/utils/solaris_netstat_parser_test.rb similarity index 100% rename from test/unit/utils/solaris_netstat_parser.rb rename to test/unit/utils/solaris_netstat_parser_test.rb