summaryrefslogtreecommitdiff
path: root/users/test/integration
diff options
context:
space:
mode:
Diffstat (limited to 'users/test/integration')
-rw-r--r--users/test/integration/api/account_flow_test.rb6
-rw-r--r--users/test/integration/api/rack_test.rb3
-rw-r--r--users/test/integration/browser/account_test.rb23
3 files changed, 26 insertions, 6 deletions
diff --git a/users/test/integration/api/account_flow_test.rb b/users/test/integration/api/account_flow_test.rb
index f5cb0b1..4c94389 100644
--- a/users/test/integration/api/account_flow_test.rb
+++ b/users/test/integration/api/account_flow_test.rb
@@ -26,19 +26,19 @@ class AccountFlowTest < RackTest
def handshake(login, aa)
post "http://api.lvh.me:3000/1/sessions.json",
:login => login,
- 'A' => aa.to_s(16),
+ 'A' => aa,
:format => :json
response = JSON.parse(last_response.body)
if response['errors']
raise RECORD_NOT_FOUND.new(response['errors'])
else
- return response['B'].hex
+ return response['B']
end
end
def validate(m)
put "http://api.lvh.me:3000/1/sessions/" + @login + '.json',
- :client_auth => m.to_s(16),
+ :client_auth => m,
:format => :json
return JSON.parse(last_response.body)
end
diff --git a/users/test/integration/api/rack_test.rb b/users/test/integration/api/rack_test.rb
index da960f2..9a69f52 100644
--- a/users/test/integration/api/rack_test.rb
+++ b/users/test/integration/api/rack_test.rb
@@ -1,6 +1,3 @@
-CONFIG_RU = (Rails.root + 'config.ru').to_s
-OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first
-
class RackTest < ActiveSupport::TestCase
include Rack::Test::Methods
include Warden::Test::Helpers
diff --git a/users/test/integration/browser/account_test.rb b/users/test/integration/browser/account_test.rb
new file mode 100644
index 0000000..ce63baf
--- /dev/null
+++ b/users/test/integration/browser/account_test.rb
@@ -0,0 +1,23 @@
+require 'test_helper'
+
+class AccountTest < BrowserIntegrationTest
+
+ setup do
+ Capybara.current_driver = Capybara.javascript_driver
+ 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'
+ assert page.has_content?("Welcome #{username}")
+ click_on 'Logout'
+ assert page.has_content?("Sign Up")
+ assert_equal '/', current_path
+ end
+
+end