aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/lib/controller/fake_models.rb
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-11-15 17:52:39 -0500
committerJosé Valim <jose.valim@gmail.com>2010-11-24 22:08:36 +0100
commitfa2a5ae0339c90d023a7559e681a588219dc3903 (patch)
tree0ae3454ed851940c59d239f08f6223d3fffaac59 /actionpack/test/lib/controller/fake_models.rb
parent66212f69acc3d51af10ff76a18ff4c0bfa305ea5 (diff)
downloadrails-fa2a5ae0339c90d023a7559e681a588219dc3903.tar.gz
rails-fa2a5ae0339c90d023a7559e681a588219dc3903.tar.bz2
rails-fa2a5ae0339c90d023a7559e681a588219dc3903.zip
If a user wants json output then try best to render json output. In such cases prefer kind_of(String) over respond_to?(to_str)
[#5841 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/lib/controller/fake_models.rb')
-rw-r--r--actionpack/test/lib/controller/fake_models.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/test/lib/controller/fake_models.rb b/actionpack/test/lib/controller/fake_models.rb
index ae0c38184d..bd18cdc1b8 100644
--- a/actionpack/test/lib/controller/fake_models.rb
+++ b/actionpack/test/lib/controller/fake_models.rb
@@ -194,3 +194,9 @@ class ArelLike
a.each { |i| yield i }
end
end
+
+class RenderJsonTestException < Exception
+ def to_json(options = nil)
+ return { :error => self.class.name, :message => self.to_str }.to_json
+ end
+end