Mercurial > repos > other > Puppet
annotate modules/stdlib/spec/functions/to_json_spec.rb @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | c42fb28cff86 |
children |
rev | line source |
---|---|
272 | 1 require 'spec_helper' |
2 | |
3 describe 'to_json' do | |
4 it { is_expected.not_to eq(nil) } | |
5 it { is_expected.to run.with_params('').and_return('""') } | |
6 it { is_expected.to run.with_params(true).and_return('true') } | |
7 it { is_expected.to run.with_params('one').and_return('"one"') } | |
8 it { is_expected.to run.with_params([]).and_return('[]') } | |
9 it { is_expected.to run.with_params(['one']).and_return('["one"]') } | |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
10 it { is_expected.to run.with_params(['one', 'two']).and_return('["one","two"]') } |
272 | 11 it { is_expected.to run.with_params({}).and_return('{}') } |
12 it { is_expected.to run.with_params('key' => 'value').and_return('{"key":"value"}') } | |
13 it { | |
275
d9352a684e62
Mass update of modules to remove deprecation warnings
IBBoard <dev@ibboard.co.uk>
parents:
272
diff
changeset
|
14 is_expected.to run.with_params('one' => { 'oneA' => 'A', 'oneB' => { 'oneB1' => '1', 'oneB2' => '2' } }, 'two' => ['twoA', 'twoB']) |
272 | 15 .and_return('{"one":{"oneA":"A","oneB":{"oneB1":"1","oneB2":"2"}},"two":["twoA","twoB"]}') |
16 } | |
17 | |
18 it { is_expected.to run.with_params('‰').and_return('"‰"') } | |
19 it { is_expected.to run.with_params('竹').and_return('"竹"') } | |
20 it { is_expected.to run.with_params('Ü').and_return('"Ü"') } | |
21 it { is_expected.to run.with_params('∇').and_return('"∇"') } | |
22 end |