2016-08-24 10:43:33 -05:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
class ProfileControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
def setup
|
|
|
|
post admin_auth_url, params: { auth:
|
|
|
|
{ email: 'alan.admin@mailinator.com', password: 'password' } }
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should get view" do
|
|
|
|
get admin_profile_url
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should get edit" do
|
|
|
|
get admin_edit_profile_url
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should post update" do
|
2016-08-24 12:53:21 -05:00
|
|
|
post admin_profile_url, params: { user: { name: 'bobby tables' } }
|
2016-08-24 10:43:33 -05:00
|
|
|
assert_redirected_to admin_profile_url
|
2016-08-24 12:53:21 -05:00
|
|
|
assert flash[:success]
|
2016-08-24 10:43:33 -05:00
|
|
|
end
|
2016-08-24 16:47:15 -05:00
|
|
|
|
|
|
|
test "should FAIL update" do
|
|
|
|
post admin_profile_url, params: { user: { name: '' } }
|
|
|
|
assert :success
|
|
|
|
assert flash[:error]
|
|
|
|
end
|
2016-08-24 10:43:33 -05:00
|
|
|
end
|
|
|
|
end
|