@@ -565,17 +565,24 class IssueTest < ActiveSupport::TestCase | |||
|
565 | 565 | |
|
566 | 566 | def test_safe_attributes_should_accept_target_tracker_writable_fields |
|
567 | 567 | WorkflowPermission.delete_all |
|
568 |
WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, |
|
|
569 | WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2, :role_id => 1, :field_name => 'start_date', :rule => 'readonly') | |
|
568 | WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, | |
|
569 | :role_id => 1, :field_name => 'due_date', | |
|
570 | :rule => 'readonly') | |
|
571 | WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2, | |
|
572 | :role_id => 1, :field_name => 'start_date', | |
|
573 | :rule => 'readonly') | |
|
570 | 574 | user = User.find(2) |
|
571 | 575 | |
|
572 | 576 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1) |
|
573 | 577 | |
|
574 |
issue.send :safe_attributes=, {'start_date' => '2012-07-12', |
|
|
578 | issue.send :safe_attributes=, {'start_date' => '2012-07-12', | |
|
579 | 'due_date' => '2012-07-14'}, user | |
|
575 | 580 | assert_equal Date.parse('2012-07-12'), issue.start_date |
|
576 | 581 | assert_nil issue.due_date |
|
577 | 582 | |
|
578 |
issue.send :safe_attributes=, {'start_date' => '2012-07-15', |
|
|
583 | issue.send :safe_attributes=, {'start_date' => '2012-07-15', | |
|
584 | 'due_date' => '2012-07-16', | |
|
585 | 'tracker_id' => 2}, user | |
|
579 | 586 | assert_equal Date.parse('2012-07-12'), issue.start_date |
|
580 | 587 | assert_equal Date.parse('2012-07-16'), issue.due_date |
|
581 | 588 | end |
General Comments 0
You need to be logged in to leave comments.
Login now