Mark Moser
1ba40c965d
Squashed commit of the following: commit fde3cc16310062842ccc676a7c33ebfe9b7a3372 Author: Mark Moser <MarkAMoser@gmail.com> Date: Sun Sep 11 19:51:32 2016 -0500 icons commit f4765d24073cdc7e790e9d6fbb73155ba96ac414 Author: Mark Moser <MarkAMoser@gmail.com> Date: Sun Sep 11 19:22:14 2016 -0500 view toggling commit 0929b005981a34e46aa0ad6e59d315d5203eed02 Author: Mark Moser <MarkAMoser@gmail.com> Date: Sun Sep 11 10:21:03 2016 -0500 controller xhr commit 859e1dff28f17feb43f9facc57f887f24e9e8fed Author: Mark Moser <MarkAMoser@gmail.com> Date: Sun Sep 11 09:18:57 2016 -0500 wip
67 lines
1.5 KiB
Ruby
67 lines
1.5 KiB
Ruby
require 'test_helper'
|
|
|
|
class AccountsControllerTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
@account = accounts(:account1)
|
|
end
|
|
|
|
test "should get index" do
|
|
get accounts_url
|
|
assert_response :success
|
|
end
|
|
|
|
test "should get new" do
|
|
get new_account_url
|
|
assert_response :success
|
|
end
|
|
|
|
test "should create account" do
|
|
assert_difference('Account.count') do
|
|
post accounts_url, params: { account: {
|
|
home: @account.home,
|
|
password: @account.password,
|
|
site: @account.site,
|
|
username: 'client-new'
|
|
} }
|
|
end
|
|
|
|
assert_redirected_to account_url(Account.last)
|
|
end
|
|
|
|
test "should show account" do
|
|
get account_url(@account)
|
|
assert_response :success
|
|
end
|
|
|
|
test "should get edit" do
|
|
get edit_account_url(@account)
|
|
assert_response :success
|
|
end
|
|
|
|
test "should update account" do
|
|
patch account_url(@account), params: { account: {
|
|
home: @account.home,
|
|
password: @account.password,
|
|
site: @account.site,
|
|
username: @account.username
|
|
} }
|
|
assert_redirected_to account_url(@account)
|
|
end
|
|
|
|
test "should destroy account" do
|
|
assert_difference('Account.count', -1) do
|
|
delete account_url(@account)
|
|
end
|
|
|
|
assert_redirected_to accounts_url
|
|
end
|
|
|
|
test 'reveal should provide password' do
|
|
get reveal_password_url(@account.to_i), xhr: true
|
|
json = JSON.parse(response.body).to_hash
|
|
|
|
assert_response :success
|
|
assert_match '1q2w3e4r5t6y7u', json['hash']
|
|
end
|
|
end
|