From 0a916fea707afaba7e0df4cd355a7a95717d85e7 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Tue, 9 Aug 2011 15:23:08 -0700 Subject: [PATCH] [#6441] Fix a Deliverable validation error when editing with a status change --- app/models/deliverable.rb | 4 +++- test/integration/deliverables_edit_test.rb | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/deliverable.rb b/app/models/deliverable.rb index 079bbc6..867ef7d 100644 --- a/app/models/deliverable.rb +++ b/app/models/deliverable.rb @@ -86,7 +86,9 @@ class Deliverable < ActiveRecord::Base noop("Allow changes to the status only") elsif changes["status"].present? && changes["status"].second == "open" noop("Allow any changes when going to 'open'") - elsif changes["status"].present? + elsif changes["status"].present? && changes["status"].first == "open" + noop("Allow any changes when going from 'open' to another status") + else errors.add_to_base(:cant_update_locked_deliverable) if locked? errors.add_to_base(:cant_update_closed_deliverable) if closed? end diff --git a/test/integration/deliverables_edit_test.rb b/test/integration/deliverables_edit_test.rb index 55a5c98..e783b54 100644 --- a/test/integration/deliverables_edit_test.rb +++ b/test/integration/deliverables_edit_test.rb @@ -618,8 +618,6 @@ class DeliverablesEditTest < ActionController::IntegrationTest end should "be allowed to change the status on a closed deliverables to Locked" do - assert @fixed_deliverable.lock! - visit_contract_page(@contract) click_link_within "#deliverable_details_#{@fixed_deliverable.id}", 'Edit' assert_response :success