summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-09-03 10:38:39 -0700
committerjessib <jessib@riseup.net>2013-09-03 10:38:39 -0700
commitf97777ed0252abe94f8d94cb4565fb5a6c35ab23 (patch)
treec943e772cf403387822364bbcbe23f59bdb17504 /users
parenta3e7cf7b667ec2080d8930b3c2659978a4c95a9b (diff)
parent1bcc76b4f50a181a1b3c137c79b627257187ac3c (diff)
Merge pull request #76 from azul/feature/3600-visual-feedback-on-failed-signup
Ensure json requests get json error response on failure
Diffstat (limited to 'users')
-rw-r--r--users/test/integration/browser/account_test.rb25
1 files changed, 18 insertions, 7 deletions
diff --git a/users/test/integration/browser/account_test.rb b/users/test/integration/browser/account_test.rb
index b412980..f3a78ed 100644
--- a/users/test/integration/browser/account_test.rb
+++ b/users/test/integration/browser/account_test.rb
@@ -7,13 +7,7 @@ class AccountTest < BrowserIntegrationTest
end
test "normal account workflow" 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
- click_on 'Sign Up'
+ username, password = submit_signup
assert page.has_content?("Welcome #{username}")
click_on 'Logout'
assert page.has_content?("Sign Up")
@@ -32,6 +26,23 @@ class AccountTest < BrowserIntegrationTest
assert page.has_no_content?("Welcome")
end
+ test "reports internal server errors" do
+ V1::UsersController.any_instance.stubs(:create).raises
+ submit_signup
+ assert page.has_content?("server failed")
+ end
+
+ def submit_signup
+ 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
+ click_on 'Sign Up'
+ return username, password
+ end
+
def inject_malicious_js
page.execute_script <<-EOJS
var calc = new srp.Calculate();