31388_apitest_failed.patch

Yuichi HARADA, 2019-06-07 04:59

Download (1.87 KB)

View differences:

test/integration/api_test/api_test.rb
40 40

  
41 41
  def test_json_datetime_format
42 42
    get '/users/1.json', :headers => credentials('admin')
43
    assert_include '"created_on":"2006-07-19T17:12:21Z"', response.body
43
    assert_include %Q["created_on":"#{Time.zone.parse('2006-07-19T17:12:21Z').iso8601}"], response.body
44 44
  end
45 45

  
46 46
  def test_xml_datetime_format
47 47
    get '/users/1.xml', :headers => credentials('admin')
48
    assert_include '<created_on>2006-07-19T17:12:21Z</created_on>', response.body
48
    assert_include "<created_on>#{Time.zone.parse('2006-07-19T17:12:21Z').iso8601}</created_on>", response.body
49 49
  end
50 50

  
51 51
  def test_head_response_should_have_empty_body
test/integration/api_test/issues_test.rb
211 211
  test "GET /issues/:id.xml with journals should format timestamps in ISO 8601" do
212 212
    get '/issues/1.xml?include=journals'
213 213

  
214
    iso_date = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/
215
    assert_select 'issue>created_on', :text => iso_date
216
    assert_select 'issue>updated_on', :text => iso_date
217
    assert_select 'issue journal>created_on', :text => iso_date
214
    issue = Issue.find(1)
215
    assert_select 'issue>created_on', :text => issue.created_on.iso8601
216
    assert_select 'issue>updated_on', :text => issue.updated_on.iso8601
217
    assert_select 'issue journal>created_on', :text => issue.journals[0].created_on.iso8601
218 218
  end
219 219

  
220 220
  test "GET /issues/:id.xml with custom fields" do