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

41 lines
814 B
Ruby

# frozen_string_literal: true
require 'test_helper'
class AccountsControllerTest < ActionDispatch::IntegrationTest
include TestAuthHelper
setup do
get auth_path
@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 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
end