forked from puppetlabs/puppetlabs-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpowershell_escape_spec.rb
More file actions
26 lines (21 loc) · 948 Bytes
/
powershell_escape_spec.rb
File metadata and controls
26 lines (21 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true
require 'spec_helper'
describe 'powershell_escape' do
it { is_expected.not_to eq(nil) }
describe 'signature validation' do
it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{'powershell_escape' expects 1 argument, got none}) }
it { is_expected.to run.with_params('foo', 'bar').and_raise_error(ArgumentError, %r{'powershell_escape' expects 1 argument, got 2}) }
end
describe 'stringification' do
it { is_expected.to run.with_params(10).and_return('10') }
it { is_expected.to run.with_params(false).and_return('false') }
end
describe 'escaping' do
it { is_expected.to run.with_params('foo').and_return('foo') }
it { is_expected.to run.with_params('foo bar').and_return('foo` bar') }
it {
is_expected.to run.with_params('~`!@#$%^&*()_-=[]\{}|;\':",./<>?')
.and_return('~``!@#`$%^&*()_-=[]\{}`|;`\':\\`",./<>?')
}
end
end