Skip to content

Commit 865a660

Browse files
Skip encoding customization test on ancient Rubies
1 parent e2e8623 commit 865a660

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/jbuilder_test.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,12 @@ class JbuilderTest < ActiveSupport::TestCase
714714
end
715715
end
716716

717-
test "respects JSON encoding customizations" do
718-
# Active Support overrides Time#as_json for custom formatting.
719-
# Ensure we call #to_json on the final attributes instead of JSON.dump.
720-
result = JSON.load(Jbuilder.new { |json| json.time Time.parse("2018-05-13 11:51:00.485 -0400") }.target!)
721-
assert_equal "2018-05-13T11:51:00.485-04:00", result["time"]
717+
if RUBY_VERSION >= "2.2.10"
718+
test "respects JSON encoding customizations" do
719+
# Active Support overrides Time#as_json for custom formatting.
720+
# Ensure we call #to_json on the final attributes instead of JSON.dump.
721+
result = JSON.load(Jbuilder.encode { |json| json.time Time.parse("2018-05-13 11:51:00.485 -0400") })
722+
assert_equal "2018-05-13T11:51:00.485-04:00", result["time"]
723+
end
722724
end
723725
end

0 commit comments

Comments
 (0)