GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 3d7102a3 authored by tmaruyama's avatar tmaruyama

Rails3: test: replace deprecated Errors#on to Errors#[] and join with to_s at...

Rails3: test: replace deprecated Errors#on to Errors#[] and join with to_s at test/unit/issue_test.rb

On Rails2, Errors#[] returns single error if one error raises.
But, on Rails3, Errors#[] always returns the array.

git-svn-id: https://svn.redmine.org/redmine/trunk@8138 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 4fd08326
......@@ -56,15 +56,18 @@ class IssueTest < ActiveSupport::TestCase
assert issue.available_custom_fields.include?(field)
# No value for the custom field
assert !issue.save
assert_equal I18n.translate('activerecord.errors.messages.invalid'), issue.errors.on(:custom_values)
assert_equal I18n.translate('activerecord.errors.messages.invalid'),
issue.errors[:custom_values].to_s
# Blank value
issue.custom_field_values = { field.id => '' }
assert !issue.save
assert_equal I18n.translate('activerecord.errors.messages.invalid'), issue.errors.on(:custom_values)
assert_equal I18n.translate('activerecord.errors.messages.invalid'),
issue.errors[:custom_values].to_s
# Invalid value
issue.custom_field_values = { field.id => 'SQLServer' }
assert !issue.save
assert_equal I18n.translate('activerecord.errors.messages.invalid'), issue.errors.on(:custom_values)
assert_equal I18n.translate('activerecord.errors.messages.invalid'),
issue.errors[:custom_values].to_s
# Valid value
issue.custom_field_values = { field.id => 'PostgreSQL' }
assert issue.save
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment