Created
December 28, 2009 20:05
-
-
Save kares/264891 to your computer and use it in GitHub Desktop.
assert an error is caused by JSON parsing for rails 2.x.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert_json_parse_exception(error) | |
if ActiveSupport::JSON.respond_to?(:parse_error) # 2.3.5 | |
parse_error_class = ActiveSupport::JSON.parse_error | |
assert_instance_of parse_error_class, error | |
else | |
assert_instance_of ActiveSupport::JSON::ParseError, error | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment