Changed assertions to make them work with Rails2/3 ruby1.8/1.9 different behaviours.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9108 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-03-05 11:03:26 +00:00
parent 97ca65d1b2
commit aa9238912b
4 changed files with 6 additions and 6 deletions

View File

@ -51,7 +51,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :attr_login => 'sn') a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :attr_login => 'sn')
a.filter = "(mail=*@redmine.org" a.filter = "(mail=*@redmine.org"
assert !a.valid? assert !a.valid?
assert_equal "is invalid", a.errors[:filter].to_s assert_include "is invalid", a.errors[:filter]
a.filter = "(mail=*@redmine.org)" a.filter = "(mail=*@redmine.org)"
assert a.valid? assert a.valid?

View File

@ -38,8 +38,8 @@ class CustomFieldTest < ActiveSupport::TestCase
def test_regexp_validation def test_regexp_validation
field = IssueCustomField.new(:name => 'regexp', :field_format => 'text', :regexp => '[a-z0-9') field = IssueCustomField.new(:name => 'regexp', :field_format => 'text', :regexp => '[a-z0-9')
assert !field.save assert !field.save
assert_equal I18n.t('activerecord.errors.messages.invalid'), assert_include I18n.t('activerecord.errors.messages.invalid'),
field.errors[:regexp].to_s field.errors[:regexp]
field.regexp = '[a-z0-9]' field.regexp = '[a-z0-9]'
assert field.save assert field.save
end end

View File

@ -78,7 +78,7 @@ class MemberTest < ActiveSupport::TestCase
set_language_if_valid 'fr' set_language_if_valid 'fr'
member = Member.new(:project_id => 1, :user_id => user.id, :role_ids => []) member = Member.new(:project_id => 1, :user_id => user.id, :role_ids => [])
assert !member.save assert !member.save
assert_equal I18n.translate('activerecord.errors.messages.empty'), member.errors[:role].to_s assert_include I18n.translate('activerecord.errors.messages.empty'), member.errors[:role]
str = "R\xc3\xb4le doit \xc3\xaatre renseign\xc3\xa9(e)" str = "R\xc3\xb4le doit \xc3\xaatre renseign\xc3\xa9(e)"
str.force_encoding('UTF-8') if str.respond_to?(:force_encoding) str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
assert_equal str, [member.errors.full_messages].flatten.join assert_equal str, [member.errors.full_messages].flatten.join

View File

@ -132,8 +132,8 @@ class RepositoryTest < ActiveSupport::TestCase
repository = Repository::Subversion.new( repository = Repository::Subversion.new(
:project => Project.find(3), :url => "svn://localhost") :project => Project.find(3), :url => "svn://localhost")
assert !repository.save assert !repository.save
assert_equal I18n.translate('activerecord.errors.messages.invalid'), assert_include I18n.translate('activerecord.errors.messages.invalid'),
repository.errors[:type].to_s repository.errors[:type]
end end
end end