2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-12 20:03:43 +00:00
|
|
|
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
|
|
|
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
2018-05-23 20:42:07 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
require 'controllers/support/shared_user_context'
|
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
describe FrontController, type: :controller do
|
2018-05-23 20:42:07 +00:00
|
|
|
describe 'authorization' do
|
|
|
|
include_context :shared_user_context
|
|
|
|
describe 'accept all' do
|
|
|
|
describe 'index' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_all, :get, :index
|
2018-05-23 20:42:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'index redirects to onboard with no non-profits' do
|
2019-07-30 21:29:24 +00:00
|
|
|
get(:index)
|
2018-05-23 20:42:07 +00:00
|
|
|
expect(response).to redirect_to onboard_url
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'have nonprofit info' do
|
|
|
|
include_context :shared_user_context
|
|
|
|
it 'redirect to nonprofit admin' do
|
|
|
|
sign_in user_as_np_admin
|
|
|
|
get(:index)
|
|
|
|
expect(response).to redirect_to NonprofitPath.dashboard(nonprofit)
|
|
|
|
end
|
|
|
|
it 'redirect to nonprofit admin' do
|
|
|
|
sign_in user_as_np_associate
|
|
|
|
get(:index)
|
|
|
|
expect(response).to redirect_to NonprofitPath.dashboard(nonprofit)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'redirect to general user' do
|
|
|
|
nonprofit
|
|
|
|
unauth_user.create_profile
|
|
|
|
sign_in unauth_user
|
|
|
|
get(:index)
|
|
|
|
expect(response).to redirect_to profile_url(unauth_user.profile.id)
|
|
|
|
end
|
|
|
|
end
|
2019-07-30 21:29:24 +00:00
|
|
|
end
|