@@ -66,7 +66,7 class TimeEntry < ActiveRecord::Base | |||||
66 | end |
|
66 | end | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | safe_attributes 'hours', 'comments', 'issue_id', 'activity_id', 'spent_on', 'custom_field_values' |
|
69 | safe_attributes 'hours', 'comments', 'issue_id', 'activity_id', 'spent_on', 'custom_field_values', 'custom_fields' | |
70 |
|
70 | |||
71 | def initialize(attributes=nil, *args) |
|
71 | def initialize(attributes=nil, *args) | |
72 | super |
|
72 | super |
@@ -79,6 +79,21 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest | |||||
79 | assert_equal 3.5, entry.hours |
|
79 | assert_equal 3.5, entry.hours | |
80 | assert_equal TimeEntryActivity.find(11), entry.activity |
|
80 | assert_equal TimeEntryActivity.find(11), entry.activity | |
81 | end |
|
81 | end | |
|
82 | ||||
|
83 | should "accept custom fields" do | |||
|
84 | field = TimeEntryCustomField.create!(:name => 'Test', :field_format => 'string') | |||
|
85 | ||||
|
86 | assert_difference 'TimeEntry.count' do | |||
|
87 | post '/time_entries.xml', {:time_entry => { | |||
|
88 | :issue_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11', :custom_fields => [{:id => field.id.to_s, :value => 'accepted'}] | |||
|
89 | }}, credentials('jsmith') | |||
|
90 | end | |||
|
91 | assert_response :created | |||
|
92 | assert_equal 'application/xml', @response.content_type | |||
|
93 | ||||
|
94 | entry = TimeEntry.first(:order => 'id DESC') | |||
|
95 | assert_equal 'accepted', entry.custom_field_value(field) | |||
|
96 | end | |||
82 | end |
|
97 | end | |
83 |
|
98 | |||
84 | context "with project_id" do |
|
99 | context "with project_id" do |
General Comments 0
You need to be logged in to leave comments.
Login now