@@ -56,6 +56,10 class Version < ActiveRecord::Base | |||
|
56 | 56 | effective_date |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | def due_date=(arg) | |
|
60 | self.effective_date=(arg) | |
|
61 | end | |
|
62 | ||
|
59 | 63 | # Returns the total estimated time for this version |
|
60 | 64 | # (sum of leaves estimated_hours) |
|
61 | 65 | def estimated_hours |
@@ -69,6 +69,20 class ApiTest::VersionsTest < ActionController::IntegrationTest | |||
|
69 | 69 | assert_tag 'version', :child => {:tag => 'id', :content => version.id.to_s} |
|
70 | 70 | end |
|
71 | 71 | |
|
72 | should "create the version with due date" do | |
|
73 | assert_difference 'Version.count' do | |
|
74 | post '/projects/1/versions.xml', {:version => {:name => 'API test', :due_date => '2012-01-24'}}, credentials('jsmith') | |
|
75 | end | |
|
76 | ||
|
77 | version = Version.first(:order => 'id DESC') | |
|
78 | assert_equal 'API test', version.name | |
|
79 | assert_equal Date.parse('2012-01-24'), version.due_date | |
|
80 | ||
|
81 | assert_response :created | |
|
82 | assert_equal 'application/xml', @response.content_type | |
|
83 | assert_tag 'version', :child => {:tag => 'id', :content => version.id.to_s} | |
|
84 | end | |
|
85 | ||
|
72 | 86 | context "with failure" do |
|
73 | 87 | should "return the errors" do |
|
74 | 88 | assert_no_difference('Version.count') do |
General Comments 0
You need to be logged in to leave comments.
Login now