Mercurial > hg > soundsoftware-site
diff test/integration/api_test/issues_test.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
line wrap: on
line diff
--- a/test/integration/api_test/issues_test.rb Tue Sep 09 09:28:31 2014 +0100 +++ b/test/integration/api_test/issues_test.rb Tue Sep 09 09:29:00 2014 +0100 @@ -162,6 +162,29 @@ end end + def test_index_should_allow_timestamp_filtering + Issue.delete_all + Issue.generate!(:subject => '1').update_column(:updated_on, Time.parse("2014-01-02T10:25:00Z")) + Issue.generate!(:subject => '2').update_column(:updated_on, Time.parse("2014-01-02T12:13:00Z")) + + get '/issues.xml', + {:set_filter => 1, :f => ['updated_on'], :op => {:updated_on => '<='}, + :v => {:updated_on => ['2014-01-02T12:00:00Z']}} + assert_select 'issues>issue', :count => 1 + assert_select 'issues>issue>subject', :text => '1' + + get '/issues.xml', + {:set_filter => 1, :f => ['updated_on'], :op => {:updated_on => '>='}, + :v => {:updated_on => ['2014-01-02T12:00:00Z']}} + assert_select 'issues>issue', :count => 1 + assert_select 'issues>issue>subject', :text => '2' + + get '/issues.xml', + {:set_filter => 1, :f => ['updated_on'], :op => {:updated_on => '>='}, + :v => {:updated_on => ['2014-01-02T08:00:00Z']}} + assert_select 'issues>issue', :count => 2 + end + context "/index.json" do should_allow_api_authentication(:get, "/projects/private-child/issues.json") end @@ -481,7 +504,7 @@ {:issue => {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3}}, credentials('jsmith') end - issue = Issue.first(:order => 'id DESC') + issue = Issue.order('id DESC').first assert_equal 1, issue.project_id assert_equal 2, issue.tracker_id assert_equal 3, issue.status_id @@ -530,7 +553,7 @@ credentials('jsmith') end - issue = Issue.first(:order => 'id DESC') + issue = Issue.order('id DESC').first assert_equal 1, issue.project_id assert_equal 2, issue.tracker_id assert_equal 3, issue.status_id @@ -781,7 +804,7 @@ end xml = Hash.from_xml(response.body) token = xml['upload']['token'] - attachment = Attachment.first(:order => 'id DESC') + attachment = Attachment.order('id DESC').first # create the issue with the upload's token assert_difference 'Issue.count' do @@ -792,7 +815,7 @@ credentials('jsmith') assert_response :created end - issue = Issue.first(:order => 'id DESC') + issue = Issue.order('id DESC').first assert_equal 1, issue.attachments.count assert_equal attachment, issue.attachments.first @@ -827,7 +850,7 @@ end xml = Hash.from_xml(response.body) token = xml['upload']['token'] - attachment = Attachment.first(:order => 'id DESC') + attachment = Attachment.order('id DESC').first # update the issue with the upload's token assert_difference 'Journal.count' do