comparison 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
comparison
equal deleted inserted replaced
274:b2571c28fc27 275:d9352a684e62
5 it { is_expected.to run.with_params('').and_return('""') } 5 it { is_expected.to run.with_params('').and_return('""') }
6 it { is_expected.to run.with_params(true).and_return('true') } 6 it { is_expected.to run.with_params(true).and_return('true') }
7 it { is_expected.to run.with_params('one').and_return('"one"') } 7 it { is_expected.to run.with_params('one').and_return('"one"') }
8 it { is_expected.to run.with_params([]).and_return('[]') } 8 it { is_expected.to run.with_params([]).and_return('[]') }
9 it { is_expected.to run.with_params(['one']).and_return('["one"]') } 9 it { is_expected.to run.with_params(['one']).and_return('["one"]') }
10 it { is_expected.to run.with_params(%w[one two]).and_return('["one","two"]') } 10 it { is_expected.to run.with_params(['one', 'two']).and_return('["one","two"]') }
11 it { is_expected.to run.with_params({}).and_return('{}') } 11 it { is_expected.to run.with_params({}).and_return('{}') }
12 it { is_expected.to run.with_params('key' => 'value').and_return('{"key":"value"}') } 12 it { is_expected.to run.with_params('key' => 'value').and_return('{"key":"value"}') }
13 it { 13 it {
14 is_expected.to run.with_params('one' => { 'oneA' => 'A', 'oneB' => { 'oneB1' => '1', 'oneB2' => '2' } }, 'two' => %w[twoA twoB]) 14 is_expected.to run.with_params('one' => { 'oneA' => 'A', 'oneB' => { 'oneB1' => '1', 'oneB2' => '2' } }, 'two' => ['twoA', 'twoB'])
15 .and_return('{"one":{"oneA":"A","oneB":{"oneB1":"1","oneB2":"2"}},"two":["twoA","twoB"]}') 15 .and_return('{"one":{"oneA":"A","oneB":{"oneB1":"1","oneB2":"2"}},"two":["twoA","twoB"]}')
16 } 16 }
17 17
18 it { is_expected.to run.with_params('‰').and_return('"‰"') } 18 it { is_expected.to run.with_params('‰').and_return('"‰"') }
19 it { is_expected.to run.with_params('竹').and_return('"竹"') } 19 it { is_expected.to run.with_params('竹').and_return('"竹"') }