spec/ballast/ajax_response_spec.rb in ballast-2.1.0 vs spec/ballast/ajax_response_spec.rb in ballast-2.1.1
- old
+ new
@@ -49,9 +49,16 @@
@transport.params[:callback] = "callback"
expect(@transport).to receive(:render).with(jsonp: "{\"status\":200,\"data\":\"DATA\",\"error\":\"ERROR\"}", status: 200, callback: "callback", content_type: nil)
subject.reply(format: :jsonp)
end
+ it "should not include the transport for pretty JSON" do
+ subject.status = 403
+
+ expect(@transport).to receive(:render).with(json: "{\n \"status\":403,\n \"data\":\"DATA\",\n \"error\":\"ERROR\"\n}\n", status: 403, callback: nil, content_type: nil)
+ subject.reply(format: nil, pretty_json: true)
+ end
+
it "should fallback to transport request format" do
subject.status = 403
expect(@transport).to receive(:render).with(json: "{\"status\":403,\"data\":\"DATA\",\"error\":\"ERROR\"}", status: 403, callback: nil, content_type: nil)
subject.reply(format: nil)
\ No newline at end of file