ftp-manager/test/controllers/accounts_controller/view_test.rb

49 lines
995 B
Ruby
Raw Permalink Normal View History

2016-09-18 09:41:51 -05:00
# frozen_string_literal: true
2016-08-27 21:40:21 -05:00
require 'test_helper'
class AccountsControllerTest < ActionDispatch::IntegrationTest
include TestAuthHelper
2016-08-27 21:40:21 -05:00
setup do
get auth_path
2016-08-28 10:32:26 -05:00
@account = accounts(:account1)
2016-08-27 21:40:21 -05:00
end
test "should get index" do
get accounts_url
2016-08-27 21:40:21 -05:00
assert_response :success
end
test "should get new" do
get new_account_url
assert_response :success
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 '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
2016-09-28 22:39:42 -05:00
test 'genpass should provide password' do
get genpass_url, xhr: true
json = JSON.parse(response.body).to_hash
assert_response :success
assert json['hash']
end
2016-08-27 21:40:21 -05:00
end