diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-14 16:29:48 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-14 16:29:48 +0000 |
commit | 008557581d8a9a428c262e09fe8f36060fe945b9 (patch) | |
tree | b80c5e2c15036634391aeebb4d62a114f21eec3e /test/unit/principal_test.rb | |
parent | bd2581e7c9584d91111ca26b55327972c2cb6727 (diff) | |
download | redmine-008557581d8a9a428c262e09fe8f36060fe945b9.tar.gz redmine-008557581d8a9a428c262e09fe8f36060fe945b9.zip |
Makes user autocompleters work with firstname and lastname.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8875 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/principal_test.rb')
-rw-r--r-- | test/unit/principal_test.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/unit/principal_test.rb b/test/unit/principal_test.rb index 694f7e027..c33286208 100644 --- a/test/unit/principal_test.rb +++ b/test/unit/principal_test.rb @@ -45,6 +45,8 @@ class PrincipalTest < ActiveSupport::TestCase Principal.generate!(:mail => 'mail@example.com') Principal.generate!(:mail => 'mail2@example.com') + + @palmer = Principal.generate!(:firstname => 'David', :lastname => 'Palmer') end should "search login" do @@ -74,6 +76,19 @@ class PrincipalTest < ActiveSupport::TestCase assert_equal 2, results.count assert results.all? {|u| u.mail.match(/mail/) } end - end + should "search firstname and lastname" do + results = Principal.like('david palm') + + assert_equal 1, results.count + assert_equal @palmer, results.first + end + + should "search lastname and firstname" do + results = Principal.like('palmer davi') + + assert_equal 1, results.count + assert_equal @palmer, results.first + end + end end |