def test_required_attribute_names_for_multiple_roles_should_intersect_rules
WorkflowPermission.delete_all
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => 'due_date', :rule => 'required')
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => 'start_date', :rule => 'required')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
+ :role_id => 1, :field_name => 'due_date',
+ :rule => 'required')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
+ :role_id => 1, :field_name => 'start_date',
+ :rule => 'required')
user = User.find(2)
member = Member.find(1)
issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
member.save!
assert_equal [], issue.required_attribute_names(user.reload)
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 2, :field_name => 'due_date', :rule => 'required')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
+ :role_id => 2, :field_name => 'due_date',
+ :rule => 'required')
assert_equal %w(due_date), issue.required_attribute_names(user)
member.role_ids = [1, 2, 3]
member.save!
assert_equal [], issue.required_attribute_names(user.reload)
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 2, :field_name => 'due_date', :rule => 'readonly')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
+ :role_id => 2, :field_name => 'due_date',
+ :rule => 'readonly')
# required + readonly => required
assert_equal %w(due_date), issue.required_attribute_names(user)
end