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-03-25 17:30:42 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
require 'controllers/support/shared_user_context'
|
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
describe NonprofitsController, type: :controller do
|
2018-03-25 17:30:42 +00:00
|
|
|
describe 'authorization' do
|
|
|
|
include_context :shared_user_context
|
|
|
|
describe 'rejects unauthorized users' do
|
|
|
|
describe 'update' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_np_associate, :put, :update, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dashboard' do
|
2019-08-02 16:20:33 +00:00
|
|
|
include_context :open_to_np_associate, :get, :dashboard, id: :__our_np, without_json_view: true
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dashboard_metrics' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_np_associate, :get, :dashboard_metrics, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'verify_identity' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_np_associate, :put, :verify_identity, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'recurring_donation_stats' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_np_associate, :get, :recurring_donation_stats, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'profile_todos' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_np_associate, :get, :profile_todos, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dashboard_todos' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_np_associate, :get, :dashboard_todos, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'payment_history' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_np_associate, :get, :payment_history, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'destroy' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_super_admin, :delete, :destroy, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'open to all' do
|
|
|
|
describe 'show' do
|
2019-08-02 16:20:33 +00:00
|
|
|
include_context :open_to_all, :get, :show, id: :__our_np, without_json_view: true
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'create' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_all, :post, :create, nonprofit_id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'btn' do
|
2019-08-02 16:20:33 +00:00
|
|
|
include_context :open_to_all, :get, :btn, id: :__our_np, without_json_view: true
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'supporter_form' do
|
2019-08-02 16:20:33 +00:00
|
|
|
include_context :open_to_all, :get, :supporter_form, id: :__our_np, without_json_view: true
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'custom_supporter' do
|
2019-07-30 21:29:24 +00:00
|
|
|
include_context :open_to_all, :post, :custom_supporter, id: :__our_np
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'donate' do
|
2019-08-02 16:20:33 +00:00
|
|
|
include_context :open_to_all, :get, :donate, id: :__our_np, without_json_view: true
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'search' do
|
|
|
|
include_context :open_to_all, :get, :search
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-05-19 20:36:57 +00:00
|
|
|
|
|
|
|
describe '#donate' do
|
|
|
|
let(:nonprofit) { force_create(:nm_justice) }
|
|
|
|
it 'allows being put into a frame by not setting X-Frame-Options header' do
|
|
|
|
get :donate, params: {id: nonprofit.id}
|
|
|
|
expect(response.headers).to_not include 'X-Frame-Options'
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#btn' do
|
|
|
|
let(:nonprofit) { force_create(:nm_justice) }
|
|
|
|
it 'allows being put into a frame by not setting X-Frame-Options header' do
|
|
|
|
get :btn, params: {id: nonprofit.id}
|
|
|
|
expect(response.headers).to_not include 'X-Frame-Options'
|
|
|
|
end
|
|
|
|
end
|
2019-07-30 21:29:24 +00:00
|
|
|
end
|