From 177dd7bff13c3f41a0e4a4455ff628dbbf9e44ca Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 16 Feb 2015 17:57:52 +0000 Subject: [PATCH] Fixed that timestamps may not be formatted as expected in XML responses (#19065). git-svn-id: http://svn.redmine.org/redmine/trunk@14015 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/views/builders/xml.rb | 5 +++-- test/integration/api_test/issues_test.rb | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/redmine/views/builders/xml.rb b/lib/redmine/views/builders/xml.rb index 37fd25d39..9f80a6088 100644 --- a/lib/redmine/views/builders/xml.rb +++ b/lib/redmine/views/builders/xml.rb @@ -30,9 +30,10 @@ module Redmine target! end - def method_missing(sym, *args, &block) + # Overrides Builder::XmlBase#tag! to format timestamps in ISO 8601 + def tag!(sym, *args, &block) if args.size == 1 && args.first.is_a?(::Time) - __send__ sym, args.first.xmlschema, &block + tag! sym, args.first.xmlschema, &block else super end diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index 78775eaed..b71b268b8 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -183,6 +183,15 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base end end + test "GET /issues/:id.xml with journals should format timestamps in ISO 8601" do + get '/issues/1.xml?include=journals' + + iso_date = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/ + assert_select 'issue>created_on', :text => iso_date + assert_select 'issue>updated_on', :text => iso_date + assert_select 'issue journal>created_on', :text => iso_date + end + test "GET /issues/:id.xml with custom fields" do get '/issues/3.xml' -- 2.39.5