forked from acullenn/puppet-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathany_puppet_to_python_spec.rb
More file actions
26 lines (25 loc) · 1.23 KB
/
any_puppet_to_python_spec.rb
File metadata and controls
26 lines (25 loc) · 1.23 KB
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
require 'spec_helper'
describe 'any_puppet_to_python' do
context 'with Array[Any]' do
it { is_expected.to run.with_params([]).and_return('[]') }
it { is_expected.to run.with_params([[[[], 1], '2'], 3]).and_return('[[[[], 1], "2"], 3]') }
it { is_expected.to run.with_params([42, 'foo', true, {}]).and_return('[42, "foo", True, {}]') }
end
context 'with Hash[Any]' do
it { is_expected.to run.with_params({}).and_return('{}') }
it { is_expected.to run.with_params({ '1' => { 2 => { '3' => {} } } }).and_return('{"1": {2: {"3": {}}}}') }
it { is_expected.to run.with_params({ 42 => 42, 'foo' => 'bar', '6 * 9' => { 'answer' => [42] } }).and_return('{42: 42, "foo": "bar", "6 * 9": {"answer": [42]}}') }
end
context 'with Boolean' do
it { is_expected.to run.with_params(true).and_return('True') }
it { is_expected.to run.with_params(false).and_return('False') }
end
context 'with String' do
it { is_expected.to run.with_params('').and_return('""') }
it { is_expected.to run.with_params('foo').and_return('"foo"') }
it { is_expected.to run.with_params("foo\nbar").and_return('"foo\nbar"') }
end
context 'with Undef' do
it { is_expected.to run.with_params(:undef).and_return('None') }
end
end