summaryrefslogtreecommitdiff
path: root/test/integration/browser/password_validation_test.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2014-04-25 19:19:24 +0200
committerazul <azul@riseup.net>2014-04-25 19:19:24 +0200
commit55fcdd3975baf6f6e167ab5164203ab9a2245186 (patch)
tree12eb857eb3475ff2895120ec29421cee2502a4c5 /test/integration/browser/password_validation_test.rb
parentb7dc6ee5220a2d7865bdd86eb86e1fbed4ca28d3 (diff)
parenta2909d781a790e47acbdbb8b4560177100ad9942 (diff)
Merge pull request #153 from azul/bugfix/5557-password-validations
basic password validation without client side gem
Diffstat (limited to 'test/integration/browser/password_validation_test.rb')
-rw-r--r--test/integration/browser/password_validation_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/integration/browser/password_validation_test.rb b/test/integration/browser/password_validation_test.rb
new file mode 100644
index 0000000..45eb0bf
--- /dev/null
+++ b/test/integration/browser/password_validation_test.rb
@@ -0,0 +1,31 @@
+require 'test_helper'
+
+class PasswordValidationTest < BrowserIntegrationTest
+
+ test "password confirmation is validated" do
+ username ||= "test_#{SecureRandom.urlsafe_base64}".downcase
+ password ||= SecureRandom.base64
+ visit '/users/new'
+ fill_in 'Username', with: username
+ fill_in 'Password', with: password
+ fill_in 'Password confirmation', with: password + "-typo"
+ click_on 'Sign Up'
+ assert page.has_content? "does not match."
+ assert_equal '/users/new', current_path
+ assert page.has_selector? ".error #srp_password_confirmation"
+ end
+
+ test "password needs to be at least 8 chars long" do
+ username ||= "test_#{SecureRandom.urlsafe_base64}".downcase
+ password ||= SecureRandom.base64[0,7]
+ visit '/users/new'
+ fill_in 'Username', with: username
+ fill_in 'Password', with: password
+ fill_in 'Password confirmation', with: password
+ click_on 'Sign Up'
+ assert page.has_content? "needs to be at least 8 characters long"
+ assert_equal '/users/new', current_path
+ assert page.has_selector? ".error #srp_password"
+ end
+end
+