summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-10-13 10:55:09 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-10-13 10:55:09 +0000
commit93daf6865ed5401bb6e5901a3e14bc2bd81a6812 (patch)
tree7e0c61dd8c1a8da07804c69f6f84d7243a711662 /test
parent0df2c4a975b78c0e2995d3f3b0d0fb4b5c1eb88f (diff)
downloadredmine-93daf6865ed5401bb6e5901a3e14bc2bd81a6812.tar.gz
redmine-93daf6865ed5401bb6e5901a3e14bc2bd81a6812.zip
code layout clean up test_required_attributes_should_be_validated of unit issue test
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10646 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/issue_test.rb36
1 files changed, 26 insertions, 10 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 048b208ce..e1d9dc5fc 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -628,26 +628,42 @@ class IssueTest < ActiveSupport::TestCase
end
def test_required_attributes_should_be_validated
- cf = IssueCustomField.create!(:name => 'Foo', :field_format => 'string', :is_for_all => true, :tracker_ids => [1, 2])
+ cf = IssueCustomField.create!(:name => 'Foo', :field_format => 'string',
+ :is_for_all => true, :tracker_ids => [1, 2])
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 => 'category_id', :rule => 'required')
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => cf.id.to_s, :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 => 'category_id',
+ :rule => 'required')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
+ :role_id => 1, :field_name => cf.id.to_s,
+ :rule => 'required')
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2, :role_id => 1, :field_name => 'start_date', :rule => 'required')
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2, :role_id => 1, :field_name => cf.id.to_s, :rule => 'required')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
+ :role_id => 1, :field_name => 'start_date',
+ :rule => 'required')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
+ :role_id => 1, :field_name => cf.id.to_s,
+ :rule => 'required')
user = User.find(2)
- issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, :subject => 'Required fields', :author => user)
- assert_equal [cf.id.to_s, "category_id", "due_date"], issue.required_attribute_names(user).sort
+ issue = Issue.new(:project_id => 1, :tracker_id => 1,
+ :status_id => 1, :subject => 'Required fields',
+ :author => user)
+ assert_equal [cf.id.to_s, "category_id", "due_date"],
+ issue.required_attribute_names(user).sort
assert !issue.save, "Issue was saved"
- assert_equal ["Category can't be blank", "Due date can't be blank", "Foo can't be blank"], issue.errors.full_messages.sort
+ assert_equal ["Category can't be blank", "Due date can't be blank", "Foo can't be blank"],
+ issue.errors.full_messages.sort
issue.tracker_id = 2
assert_equal [cf.id.to_s, "start_date"], issue.required_attribute_names(user).sort
assert !issue.save, "Issue was saved"
- assert_equal ["Foo can't be blank", "Start date can't be blank"], issue.errors.full_messages.sort
+ assert_equal ["Foo can't be blank", "Start date can't be blank"],
+ issue.errors.full_messages.sort
issue.start_date = Date.today
issue.custom_field_values = {cf.id.to_s => 'bar'}