@@ -131,11 +131,11 @@ def test_run_with_dashed_resource_name
131131 assert_equal ( "/another-resource" , request [ :path ] )
132132 Excon . stubs . pop
133133 { status : 200 , headers : { 'Content-Type' => 'application/json' } ,
134- body : MultiJson . dump ( result ) }
134+ body : JSON . generate ( result ) }
135135 end
136136
137137 cli . run ( 'another-resource:list' )
138- assert_equal ( MultiJson . dump ( result , pretty : true ) + "\n " , output . string )
138+ assert_equal ( JSON . pretty_generate ( result ) + "\n " , output . string )
139139 end
140140
141141 # CLI.run runs the command matching the specified name and passes parameters
@@ -154,14 +154,14 @@ def test_run_with_parameters
154154 Excon . stub ( method : :patch ) do |request |
155155 assert_equal ( "/resource/#{ uuid } " , request [ :path ] )
156156 assert_equal ( 'application/json' , request [ :headers ] [ 'Content-Type' ] )
157- assert_equal ( body , MultiJson . load ( request [ :body ] ) )
157+ assert_equal ( body , JSON . parse ( request [ :body ] ) )
158158 Excon . stubs . pop
159159 { status : 200 , headers : { 'Content-Type' => 'application/json' } ,
160- body : MultiJson . dump ( result ) }
160+ body : JSON . generate ( result ) }
161161 end
162162
163163 cli . run ( 'resource:update' , uuid , body )
164- assert_equal ( MultiJson . dump ( result , pretty : true ) + "\n " , output . string )
164+ assert_equal ( JSON . pretty_generate ( result ) + "\n " , output . string )
165165 end
166166end
167167
@@ -176,17 +176,17 @@ def test_cli_from_schema
176176 Excon . stub ( method : :patch ) do |request |
177177 assert_equal ( "/resource/#{ uuid } " , request [ :path ] )
178178 assert_equal ( 'application/json' , request [ :headers ] [ 'Content-Type' ] )
179- assert_equal ( body , MultiJson . load ( request [ :body ] ) )
179+ assert_equal ( body , JSON . parse ( request [ :body ] ) )
180180 Excon . stubs . pop
181181 { status : 200 , headers : { 'Content-Type' => 'application/json' } ,
182- body : MultiJson . dump ( result ) }
182+ body : JSON . generate ( result ) }
183183 end
184184
185185 schema = Heroics ::Schema . new ( SAMPLE_SCHEMA )
186186 output = StringIO . new
187187 cli = Heroics . cli_from_schema ( 'cli' , output , schema , 'https://example.com' )
188188 cli . run ( 'resource:update' , uuid , body )
189- assert_equal ( MultiJson . dump ( result , pretty : true ) + "\n " , output . string )
189+ assert_equal ( JSON . pretty_generate ( result ) + "\n " , output . string )
190190 end
191191
192192 # cli_from_schema returns a CLI that can make requests to APIs mounted under
@@ -198,18 +198,18 @@ def test_client_from_schema_with_url_prefix
198198 Excon . stub ( method : :patch ) do |request |
199199 assert_equal ( "/api/resource/#{ uuid } " , request [ :path ] )
200200 assert_equal ( 'application/json' , request [ :headers ] [ 'Content-Type' ] )
201- assert_equal ( body , MultiJson . load ( request [ :body ] ) )
201+ assert_equal ( body , JSON . parse ( request [ :body ] ) )
202202 Excon . stubs . pop
203203 { status : 200 , headers : { 'Content-Type' => 'application/json' } ,
204- body : MultiJson . dump ( result ) }
204+ body : JSON . generate ( result ) }
205205 end
206206
207207 schema = Heroics ::Schema . new ( SAMPLE_SCHEMA )
208208 output = StringIO . new
209209 cli = Heroics . cli_from_schema ( 'cli' , output , schema ,
210210 'https://example.com/api' )
211211 cli . run ( 'resource:update' , uuid , body )
212- assert_equal ( MultiJson . dump ( result , pretty : true ) + "\n " , output . string )
212+ assert_equal ( JSON . pretty_generate ( result ) + "\n " , output . string )
213213 end
214214
215215 # cli_from_schema optionally accepts custom headers to pass with every
@@ -223,7 +223,7 @@ def test_cli_from_schema_with_custom_headers
223223 request [ :headers ] [ 'Accept' ] )
224224 Excon . stubs . pop
225225 { status : 200 , headers : { 'Content-Type' => 'application/json' } ,
226- body : MultiJson . dump ( result ) }
226+ body : JSON . generate ( result ) }
227227 end
228228
229229 schema = Heroics ::Schema . new ( SAMPLE_SCHEMA )
@@ -232,6 +232,6 @@ def test_cli_from_schema_with_custom_headers
232232 'cli' , output , schema , 'https://example.com' ,
233233 default_headers : { 'Accept' => 'application/vnd.heroku+json; version=3' } )
234234 cli . run ( 'resource:update' , uuid , body )
235- assert_equal ( MultiJson . dump ( result , pretty : true ) + "\n " , output . string )
235+ assert_equal ( JSON . pretty_generate ( result ) + "\n " , output . string )
236236 end
237237end
0 commit comments