@@ -603,17 +603,26 class IssueTest < ActiveSupport::TestCase | |||
|
603 | 603 | |
|
604 | 604 | def test_safe_attributes_should_accept_target_status_writable_fields |
|
605 | 605 | WorkflowPermission.delete_all |
|
606 |
WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, |
|
|
607 | WorkflowPermission.create!(:old_status_id => 2, :tracker_id => 1, :role_id => 1, :field_name => 'start_date', :rule => 'readonly') | |
|
606 | WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, | |
|
607 | :role_id => 1, :field_name => 'due_date', | |
|
608 | :rule => 'readonly') | |
|
609 | WorkflowPermission.create!(:old_status_id => 2, :tracker_id => 1, | |
|
610 | :role_id => 1, :field_name => 'start_date', | |
|
611 | :rule => 'readonly') | |
|
608 | 612 | user = User.find(2) |
|
609 | 613 | |
|
610 | 614 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1) |
|
611 | 615 | |
|
612 |
issue.send :safe_attributes=, {'start_date' => '2012-07-12', |
|
|
616 | issue.send :safe_attributes=, {'start_date' => '2012-07-12', | |
|
617 | 'due_date' => '2012-07-14'}, | |
|
618 | user | |
|
613 | 619 | assert_equal Date.parse('2012-07-12'), issue.start_date |
|
614 | 620 | assert_nil issue.due_date |
|
615 | 621 | |
|
616 |
issue.send :safe_attributes=, {'start_date' => '2012-07-15', |
|
|
622 | issue.send :safe_attributes=, {'start_date' => '2012-07-15', | |
|
623 | 'due_date' => '2012-07-16', | |
|
624 | 'status_id' => 2}, | |
|
625 | user | |
|
617 | 626 | assert_equal Date.parse('2012-07-12'), issue.start_date |
|
618 | 627 | assert_equal Date.parse('2012-07-16'), issue.due_date |
|
619 | 628 | end |
General Comments 0
You need to be logged in to leave comments.
Login now