Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't double escape single quotes

  • Loading branch information...
commit 5921b29b7ac9f7552115d10940118a68377176ff 1 parent 3e9d29f
@dewski dewski authored
Showing with 5 additions and 1 deletion.
  1. +1 −1  lib/json_builder/extensions.rb
  2. +4 −0 test/member_test.rb
View
2  lib/json_builder/extensions.rb
@@ -20,7 +20,7 @@ class String
"\n" => '\n',
"\r" => '\n',
'"' => '\\"',
- "'" => "\\'"
+ "'" => "\'"
}
def to_builder
View
4 test/member_test.rb
@@ -43,6 +43,10 @@ def test_double_quoted_value
assert_equal '"hello": "\"Hello\" he said"', member('hello', '"Hello" he said').to_s
end
+ def test_single_quoted_value
+ assert_equal %Q("hello": "hello 'test'!"), member('hello', "hello 'test'!").to_s
+ end
+
def test_without_key
assert_raises(JSONBuilder::MissingKeyError) { member(nil, true).to_s }
end
Please sign in to comment.
Something went wrong with that request. Please try again.