Permalink
Browse files

added tests for user search regex processing

  • Loading branch information...
1 parent b65159a commit 484382d88a4040964e2f60432a8bdd379bd7178f @buddhamagnet buddhamagnet committed Apr 1, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/acceptance/user_search_test.rb
@@ -26,6 +26,20 @@
visit "/users?search=ebr"
assert has_content?("zebra")
end
+
+ it "copes an with asterisk in the search string" do
+ visit "/users?search=*"
+ assert_equal 200, page.status_code, "search input (*) caused a #{page.status_code} response"
+ assert has_content?("Please enter a valid search term"), "search input (*) did not cause a flash message"
+ end
+
+ it "copes with URL-escaped input in the search string" do
+ %w[ ? + {1} {1,} {1,2}].each do |n|
+ visit "/users?search=#{CGI.escape(n)}"
+ assert_equal 200, page.status_code, "search input #{n} caused a #{page.status_code} response"
+ assert has_content?("Please enter a valid search term"), "search input #{n} did not cause a flash message"
+ end
+ end
it "finds users case-insensitively" do
visit "/users?search=ZEBR"

0 comments on commit 484382d

Please sign in to comment.