summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-10-13 10:51:21 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-10-13 10:51:21 +0000
commited9f954c6cbeeb84ebf9f21d0613d5493647e019 (patch)
treedcacc6cd88411841e066f31cd41d6f31afc8ad59 /test
parent0f6be546b8f555b60c3a0381f321544e4b32736f (diff)
downloadredmine-ed9f954c6cbeeb84ebf9f21d0613d5493647e019.tar.gz
redmine-ed9f954c6cbeeb84ebf9f21d0613d5493647e019.zip
code layout clean up test_safe_attributes_should_not_include_readonly_custom_fields of unit issue test
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10640 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/issue_test.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index e0964a300..b863278d2 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -513,22 +513,31 @@ class IssueTest < ActiveSupport::TestCase
end
def test_safe_attributes_should_not_include_readonly_custom_fields
- cf1 = IssueCustomField.create!(:name => 'Writable field', :field_format => 'string', :is_for_all => true, :tracker_ids => [1])
- cf2 = IssueCustomField.create!(:name => 'Readonly field', :field_format => 'string', :is_for_all => true, :tracker_ids => [1])
-
+ cf1 = IssueCustomField.create!(:name => 'Writable field',
+ :field_format => 'string',
+ :is_for_all => true, :tracker_ids => [1])
+ cf2 = IssueCustomField.create!(:name => 'Readonly field',
+ :field_format => 'string',
+ :is_for_all => true, :tracker_ids => [1])
WorkflowPermission.delete_all
- WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => cf2.id.to_s, :rule => 'readonly')
+ WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
+ :role_id => 1, :field_name => cf2.id.to_s,
+ :rule => 'readonly')
user = User.find(2)
-
issue = Issue.new(:project_id => 1, :tracker_id => 1)
assert_equal [cf2.id.to_s], issue.read_only_attribute_names(user)
assert_not_include cf2.id.to_s, issue.safe_attribute_names(user)
- issue.send :safe_attributes=, {'custom_field_values' => {cf1.id.to_s => 'value1', cf2.id.to_s => 'value2'}}, user
+ issue.send :safe_attributes=, {'custom_field_values' => {
+ cf1.id.to_s => 'value1', cf2.id.to_s => 'value2'
+ }}, user
assert_equal 'value1', issue.custom_field_value(cf1)
assert_nil issue.custom_field_value(cf2)
- issue.send :safe_attributes=, {'custom_fields' => [{'id' => cf1.id.to_s, 'value' => 'valuea'}, {'id' => cf2.id.to_s, 'value' => 'valueb'}]}, user
+ issue.send :safe_attributes=, {'custom_fields' => [
+ {'id' => cf1.id.to_s, 'value' => 'valuea'},
+ {'id' => cf2.id.to_s, 'value' => 'valueb'}
+ ]}, user
assert_equal 'valuea', issue.custom_field_value(cf1)
assert_nil issue.custom_field_value(cf2)
end