##// END OF EJS Templates
code layout clean up test_safe_attributes_should_accept_target_tracker_writable_fields of unit issue test...
Toshi MARUYAMA -
r10431:7a162b725597
parent child
Show More
@@ -565,17 +565,24 class IssueTest < ActiveSupport::TestCase
565
565
566 def test_safe_attributes_should_accept_target_tracker_writable_fields
566 def test_safe_attributes_should_accept_target_tracker_writable_fields
567 WorkflowPermission.delete_all
567 WorkflowPermission.delete_all
568 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => 'due_date', :rule => 'readonly')
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')
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 user = User.find(2)
574 user = User.find(2)
571
575
572 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
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', 'due_date' => '2012-07-14'}, user
578 issue.send :safe_attributes=, {'start_date' => '2012-07-12',
579 'due_date' => '2012-07-14'}, user
575 assert_equal Date.parse('2012-07-12'), issue.start_date
580 assert_equal Date.parse('2012-07-12'), issue.start_date
576 assert_nil issue.due_date
581 assert_nil issue.due_date
577
582
578 issue.send :safe_attributes=, {'start_date' => '2012-07-15', 'due_date' => '2012-07-16', 'tracker_id' => 2}, user
583 issue.send :safe_attributes=, {'start_date' => '2012-07-15',
584 'due_date' => '2012-07-16',
585 'tracker_id' => 2}, user
579 assert_equal Date.parse('2012-07-12'), issue.start_date
586 assert_equal Date.parse('2012-07-12'), issue.start_date
580 assert_equal Date.parse('2012-07-16'), issue.due_date
587 assert_equal Date.parse('2012-07-16'), issue.due_date
581 end
588 end
General Comments 0
You need to be logged in to leave comments. Login now