Mercurial > hg > soundsoftware-site
comparison test/integration/api_test/time_entries_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 |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
60 post '/time_entries.xml', {:time_entry => {:issue_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith') | 60 post '/time_entries.xml', {:time_entry => {:issue_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith') |
61 end | 61 end |
62 assert_response :created | 62 assert_response :created |
63 assert_equal 'application/xml', @response.content_type | 63 assert_equal 'application/xml', @response.content_type |
64 | 64 |
65 entry = TimeEntry.first(:order => 'id DESC') | 65 entry = TimeEntry.order('id DESC').first |
66 assert_equal 'jsmith', entry.user.login | 66 assert_equal 'jsmith', entry.user.login |
67 assert_equal Issue.find(1), entry.issue | 67 assert_equal Issue.find(1), entry.issue |
68 assert_equal Project.find(1), entry.project | 68 assert_equal Project.find(1), entry.project |
69 assert_equal Date.parse('2010-12-02'), entry.spent_on | 69 assert_equal Date.parse('2010-12-02'), entry.spent_on |
70 assert_equal 3.5, entry.hours | 70 assert_equal 3.5, entry.hours |
80 }}, credentials('jsmith') | 80 }}, credentials('jsmith') |
81 end | 81 end |
82 assert_response :created | 82 assert_response :created |
83 assert_equal 'application/xml', @response.content_type | 83 assert_equal 'application/xml', @response.content_type |
84 | 84 |
85 entry = TimeEntry.first(:order => 'id DESC') | 85 entry = TimeEntry.order('id DESC').first |
86 assert_equal 'accepted', entry.custom_field_value(field) | 86 assert_equal 'accepted', entry.custom_field_value(field) |
87 end | 87 end |
88 | 88 |
89 test "POST /time_entries.xml with project_id should create time entry" do | 89 test "POST /time_entries.xml with project_id should create time entry" do |
90 assert_difference 'TimeEntry.count' do | 90 assert_difference 'TimeEntry.count' do |
91 post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith') | 91 post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith') |
92 end | 92 end |
93 assert_response :created | 93 assert_response :created |
94 assert_equal 'application/xml', @response.content_type | 94 assert_equal 'application/xml', @response.content_type |
95 | 95 |
96 entry = TimeEntry.first(:order => 'id DESC') | 96 entry = TimeEntry.order('id DESC').first |
97 assert_equal 'jsmith', entry.user.login | 97 assert_equal 'jsmith', entry.user.login |
98 assert_nil entry.issue | 98 assert_nil entry.issue |
99 assert_equal Project.find(1), entry.project | 99 assert_equal Project.find(1), entry.project |
100 assert_equal Date.parse('2010-12-02'), entry.spent_on | 100 assert_equal Date.parse('2010-12-02'), entry.spent_on |
101 assert_equal 3.5, entry.hours | 101 assert_equal 3.5, entry.hours |