summaryrefslogtreecommitdiff
path: root/users/test/integration
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-09-19 12:07:25 -0700
committerjessib <jessib@riseup.net>2013-09-19 12:07:25 -0700
commit3a2e64c75f67af89ffd78dbf80dd947896d85d22 (patch)
treeea17ee32d763bb875e4814b09ed1f443c112980c /users/test/integration
parente8a2db42813dc3f5d1ebb95eb896455d7a922505 (diff)
parent890c9e170fc038eccb46eca3c1ddcf6f05eaa53f (diff)
Merge branch 'develop' into feature/only_lower_case_aliases
Diffstat (limited to 'users/test/integration')
-rw-r--r--users/test/integration/browser/account_test.rb15
-rw-r--r--users/test/integration/browser/session_test.rb28
2 files changed, 29 insertions, 14 deletions
diff --git a/users/test/integration/browser/account_test.rb b/users/test/integration/browser/account_test.rb
index a5ec2c5..8c2c997 100644
--- a/users/test/integration/browser/account_test.rb
+++ b/users/test/integration/browser/account_test.rb
@@ -13,9 +13,7 @@ class AccountTest < BrowserIntegrationTest
assert page.has_content?("Sign Up")
assert_equal '/', current_path
assert user = User.find_by_login(username)
- assert id = user.identity
- id.destroy
- user.destroy
+ user.account.destroy
end
test "successful login" do
@@ -47,17 +45,6 @@ class AccountTest < BrowserIntegrationTest
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();
diff --git a/users/test/integration/browser/session_test.rb b/users/test/integration/browser/session_test.rb
new file mode 100644
index 0000000..bb4e8c9
--- /dev/null
+++ b/users/test/integration/browser/session_test.rb
@@ -0,0 +1,28 @@
+require 'test_helper'
+
+class SessionTest < BrowserIntegrationTest
+
+ setup do
+ Capybara.current_driver = Capybara.javascript_driver
+ @username, password = submit_signup
+ end
+
+ teardown do
+ user = User.find_by_login(@username)
+ id = user.identity
+ id.destroy
+ user.destroy
+ end
+
+ test "valid session" do
+ assert page.has_content?("Welcome #{@username}")
+ end
+
+ test "expired session" do
+ assert page.has_content?("Welcome #{@username}")
+ pretend_now_is(Time.now + 40.minutes) do
+ visit '/'
+ assert page.has_no_content?("Welcome #{@username}")
+ end
+ end
+end