diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-13 05:43:02 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-13 05:43:02 -0700 |
commit | 053a0f6ac48d35fd39d385df5d810078e92c521e (patch) | |
tree | 267b87f3e9d07f955e4d5122c1da83597dc631a2 /activesupport/lib | |
parent | 7d2add8c966b318144bb5c5c43112cc02341ead4 (diff) | |
download | rails-053a0f6ac48d35fd39d385df5d810078e92c521e.tar.gz rails-053a0f6ac48d35fd39d385df5d810078e92c521e.tar.bz2 rails-053a0f6ac48d35fd39d385df5d810078e92c521e.zip |
Clean up spurious JSON decoding test failure
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/json/backends/jsongem.rb | 5 | ||||
-rw-r--r-- | activesupport/lib/active_support/json/backends/yaml.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/json/decoding.rb | 2 |
3 files changed, 5 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/json/backends/jsongem.rb b/activesupport/lib/active_support/json/backends/jsongem.rb index 649e6301d1..c6c17a3c4e 100644 --- a/activesupport/lib/active_support/json/backends/jsongem.rb +++ b/activesupport/lib/active_support/json/backends/jsongem.rb @@ -2,10 +2,9 @@ require 'json' unless defined?(JSON) module ActiveSupport module JSON - ParseError = ::JSON::ParserError unless const_defined?(:ParseError) - module Backends module JSONGem + ParseError = ::JSON::ParserError extend self # Parses a JSON string or IO and convert it into an object @@ -38,4 +37,4 @@ module ActiveSupport end end end -end
\ No newline at end of file +end diff --git a/activesupport/lib/active_support/json/backends/yaml.rb b/activesupport/lib/active_support/json/backends/yaml.rb index 59d2c37e40..215b3d6f90 100644 --- a/activesupport/lib/active_support/json/backends/yaml.rb +++ b/activesupport/lib/active_support/json/backends/yaml.rb @@ -2,13 +2,9 @@ require 'active_support/core_ext/string/starts_ends_with' module ActiveSupport module JSON - unless const_defined?(:ParseError) - class ParseError < StandardError - end - end - module Backends module Yaml + ParseError = ::StandardError extend self # Parses a JSON string or IO and converts it into an object diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb index 356b6cebeb..a5908365af 100644 --- a/activesupport/lib/active_support/json/decoding.rb +++ b/activesupport/lib/active_support/json/decoding.rb @@ -7,6 +7,7 @@ module ActiveSupport module JSON class << self + attr_reader :parse_error delegate :decode, :to => :backend def backend @@ -21,6 +22,7 @@ module ActiveSupport require "active_support/json/backends/#{name.to_s.downcase}.rb" @backend = ActiveSupport::JSON::Backends::const_get(name) end + @parse_error = @backend::ParseError end def with_backend(name) |