summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-30 20:55:48 -0400
committerHo-Sheng Hsiao <hosh@opscode.com>2012-05-10 14:48:30 -0400
commit80adf2038b317e94cc2044eb2bc9a4299bb1905d (patch)
treec32582ab4e52fd3241d19bb503411665cec560e8 /spec
parent743dd889999b6a5c4e4e7dbc4dd3d37dd9d92820 (diff)
downloadmixlib-shellout-80adf2038b317e94cc2044eb2bc9a4299bb1905d.tar.gz
[CHEF-2994][WINDOWS] Added unit tests for valid batch files
Diffstat (limited to 'spec')
-rw-r--r--spec/mixlib/shellout/windows_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/mixlib/shellout/windows_spec.rb b/spec/mixlib/shellout/windows_spec.rb
index a5586f7..d8ecea0 100644
--- a/spec/mixlib/shellout/windows_spec.rb
+++ b/spec/mixlib/shellout/windows_spec.rb
@@ -5,6 +5,23 @@ describe Mixlib::ShellOut::Windows, :windows_only => true do
# Caveat: Private API methods are subject to change without notice.
# Monkeypatch at your own risk.
context 'for private API methods' do
+
+ describe '::IS_BATCH_FILE' do
+ subject { candidate =~ Mixlib::ShellOut::Windows::IS_BATCH_FILE }
+
+ def self.with_candidate(_context, _options = {}, &example)
+ context "with #{_context}" do
+ let(:candidate) { _options[:candidate] }
+ it(&example)
+ end
+ end
+
+ with_candidate('valid .bat file', :candidate => 'autoexec.bat') { should be_true }
+ with_candidate('valid .cmd file', :candidate => 'autoexec.cmd') { should be_true }
+ with_candidate('valid quoted .bat file', :candidate => '"C:\Program Files\autoexec.bat"') { should be_true }
+ with_candidate('valid quoted .cmd file', :candidate => '"C:\Program Files\autoexec.cmd"') { should be_true }
+ end
+
describe '#command_to_run' do
subject { stubbed_shell_out.send(:command_to_run, cmd) }