spec/rack/webconsole/repl_spec.rb in rack-webconsole-0.1.2 vs spec/rack/webconsole/repl_spec.rb in rack-webconsole-0.1.3
- old
+ new
@@ -21,11 +21,11 @@
@repl = Webconsole::Repl.new(@app)
response = @repl.call(env).last.first
- JSON.parse(response)['result'].must_equal "8"
+ MultiJson.decode(response)['result'].must_equal "8"
end
it 'maintains local state in subsequent calls thanks to an evil global variable' do
@app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['hello world']] }
env = {}
@@ -39,11 +39,11 @@
request = OpenStruct.new(:params => {'query' => 'a * 8', 'token' => 'abc'}, :post? => true)
Rack::Request.stubs(:new).returns request
response = @repl.call(env).last.first # call 2 retrieves a and multiplies it by 8
- JSON.parse(response)['result'].must_equal "32"
+ MultiJson.decode(response)['result'].must_equal "32"
$sandbox.instance_variable_get(:@locals)[:a].must_equal 4
$sandbox.instance_variable_get(:@locals).size.must_equal 1
end
it "returns any found errors prepended with 'Error:'" do
@@ -54,10 +54,10 @@
Rack::Request.stubs(:new).returns request
@repl = Webconsole::Repl.new(@app)
response = @repl.call(env).last.first
- JSON.parse(response)['result'].must_match /Error:/
+ MultiJson.decode(response)['result'].must_match /Error:/
end
it 'rejects non-post requests' do
@app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['hello world']] }
env = {}