Project

General

Profile

Defect #5834 » 0002-Defect-5834-remove-trailing-whitespace-from-mail-bef.patch

Carin Meier, 2010-07-22 06:15

View differences:

test/unit/user_test.rb
83 83
    assert_equal I18n.translate('activerecord.errors.messages.taken'), u.errors.on(:mail)
84 84
  end
85 85

  
86

  
87
  def test_mail_should_chop_trailing_spaces
88
    u = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo    ")
89
    u.login = 'newuser'
90
    u.password, u.password_confirmation = "password", "password"
91
    assert u.save
92

  
93
    #does not chop leading spaces
94
    u = User.new(:firstname => "new", :lastname => "user", :mail => "    newuser@somenet.foo    ")
95
    u.login = 'newuser'
96
    u.password, u.password_confirmation = "password", "password"
97
    assert !u.save
98

  
99
  end
100

  
86 101
  def test_update
87 102
    assert_equal "admin", @admin.login
88 103
    @admin.login = "john"
(1-1/2)