test(views): add arg for views without json format
This commit is contained in:
		
							parent
							
								
									fd564be0bc
								
							
						
					
					
						commit
						c21ddbba06
					
				
					 21 changed files with 51 additions and 39 deletions
				
			
		| 
						 | 
					@ -20,7 +20,7 @@ describe BillingSubscriptionsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'cancellation' do
 | 
					    describe 'cancellation' do
 | 
				
			||||||
      include_context :open_to_np_admin, :get, :cancellation, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_admin, :get, :cancellation, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ describe Campaigns::SupportersController, type: :controller do
 | 
				
			||||||
    include_context :shared_user_context
 | 
					    include_context :shared_user_context
 | 
				
			||||||
    describe 'reject unauthorized' do
 | 
					    describe 'reject unauthorized' do
 | 
				
			||||||
      describe 'index' do
 | 
					      describe 'index' do
 | 
				
			||||||
        include_context :open_to_campaign_editor, :get, :index, nonprofit_id: :__our_np, campaign_id: :__our_campaign
 | 
					        include_context :open_to_campaign_editor, :get, :index, nonprofit_id: :__our_np, campaign_id: :__our_campaign, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,11 +30,11 @@ describe CampaignsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    describe 'open to all' do
 | 
					    describe 'open to all' do
 | 
				
			||||||
      describe 'index' do
 | 
					      describe 'index' do
 | 
				
			||||||
        include_context :open_to_all, :get, :index, nonprofit_id: :__our_np
 | 
					        include_context :open_to_all, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'show' do
 | 
					      describe 'show' do
 | 
				
			||||||
        include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, id: :__our_campaign
 | 
					        include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, id: :__our_campaign, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'activities' do
 | 
					      describe 'activities' do
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ describe CampaignsController, type: :controller do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'peer_to_peer' do
 | 
					      describe 'peer_to_peer' do
 | 
				
			||||||
        include_context :open_to_all, :get, :peer_to_peer, nonprofit_id: :__our_np
 | 
					        include_context :open_to_all, :get, :peer_to_peer, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ describe EventsController, type: :controller do
 | 
				
			||||||
      include_context :open_to_event_editor, :delete, :soft_delete, nonprofit_id: :__our_np, event_id: :__our_event
 | 
					      include_context :open_to_event_editor, :delete, :soft_delete, nonprofit_id: :__our_np, event_id: :__our_event
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    describe 'stats' do
 | 
					    describe 'stats' do
 | 
				
			||||||
      include_context :open_to_event_editor, :get, :stats, nonprofit_id: :__our_np, id: :__our_event
 | 
					      include_context :open_to_event_editor, :get, :stats, nonprofit_id: :__our_np, id: :__our_event, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'name_and_id' do
 | 
					    describe 'name_and_id' do
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@ describe EventsController, type: :controller do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe 'open to all' do
 | 
					  describe 'open to all' do
 | 
				
			||||||
    describe 'index' do
 | 
					    describe 'index' do
 | 
				
			||||||
      include_context :open_to_all, :get, :index, nonprofit_id: :__our_np
 | 
					      include_context :open_to_all, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'listings' do
 | 
					    describe 'listings' do
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@ describe EventsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'show' do
 | 
					    describe 'show' do
 | 
				
			||||||
      include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, id: :__our_event
 | 
					      include_context :open_to_all, :get, :show, nonprofit_id: :__our_np, id: :__our_event, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'activities' do
 | 
					    describe 'activities' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,21 +9,21 @@ describe MapsController, type: :controller do
 | 
				
			||||||
    include_context :shared_user_context
 | 
					    include_context :shared_user_context
 | 
				
			||||||
    describe 'rejects unauthorized users' do
 | 
					    describe 'rejects unauthorized users' do
 | 
				
			||||||
      describe 'all_supporters' do
 | 
					      describe 'all_supporters' do
 | 
				
			||||||
        include_context :open_to_super_admin, :get, :all_supporters
 | 
					        include_context :open_to_super_admin, :get, :all_supporters, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'all_npo_supporters' do
 | 
					      describe 'all_npo_supporters' do
 | 
				
			||||||
        include_context :open_to_np_associate, :get, :all_npo_supporters, nonprofit_id: :__our_np
 | 
					        include_context :open_to_np_associate, :get, :all_npo_supporters, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'specific_npo_supporters' do
 | 
					      describe 'specific_npo_supporters' do
 | 
				
			||||||
        include_context :open_to_np_associate, :get, :specific_npo_supporters, nonprofit_id: :__our_np
 | 
					        include_context :open_to_np_associate, :get, :specific_npo_supporters, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'open_to_all' do
 | 
					    describe 'open_to_all' do
 | 
				
			||||||
      describe 'all_npos' do
 | 
					      describe 'all_npos' do
 | 
				
			||||||
        include_context :open_to_all, :get, :all_npos, nonprofit_id: :__our_np
 | 
					        include_context :open_to_all, :get, :all_npos, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ describe Nonprofits::BankAccountsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'confirmation' do
 | 
					    describe 'confirmation' do
 | 
				
			||||||
      include_context :open_to_np_admin, :get, :confirmation, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_admin, :get, :confirmation, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'confirm' do
 | 
					    describe 'confirm' do
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ describe Nonprofits::BankAccountsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'cancellation' do
 | 
					    describe 'cancellation' do
 | 
				
			||||||
      include_context :open_to_np_admin, :get, :cancellation, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_admin, :get, :cancellation, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'cancel' do
 | 
					    describe 'cancel' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,15 +12,15 @@ describe Nonprofits::ButtonController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'basic' do
 | 
					    describe 'basic' do
 | 
				
			||||||
      include_context :open_to_registered, :get, :basic, nonprofit_id: :__our_np
 | 
					      include_context :open_to_registered, :get, :basic, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'guided' do
 | 
					    describe 'guided' do
 | 
				
			||||||
      include_context :open_to_registered, :get, :guided, nonprofit_id: :__our_np
 | 
					      include_context :open_to_registered, :get, :guided, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'advanced' do
 | 
					    describe 'advanced' do
 | 
				
			||||||
      include_context :open_to_registered, :get, :advanced, nonprofit_id: :__our_np
 | 
					      include_context :open_to_registered, :get, :advanced, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ describe Nonprofits::CardsController, type: :controller do
 | 
				
			||||||
  include_context :shared_user_context
 | 
					  include_context :shared_user_context
 | 
				
			||||||
  describe 'rejects unauthenticated users' do
 | 
					  describe 'rejects unauthenticated users' do
 | 
				
			||||||
    describe 'show' do
 | 
					    describe 'show' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :edit, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_associate, :get, :edit, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'create' do
 | 
					    describe 'create' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ describe Nonprofits::CustomFieldMastersController, type: :controller do
 | 
				
			||||||
  include_context :shared_user_context
 | 
					  include_context :shared_user_context
 | 
				
			||||||
  describe 'rejects unauthenticated users' do
 | 
					  describe 'rejects unauthenticated users' do
 | 
				
			||||||
    describe 'get payments' do
 | 
					    describe 'get payments' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'create' do
 | 
					    describe 'create' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ describe Nonprofits::CustomFieldJoinsController, type: :controller do
 | 
				
			||||||
  include_context :shared_user_context
 | 
					  include_context :shared_user_context
 | 
				
			||||||
  describe 'rejects unauthenticated users' do
 | 
					  describe 'rejects unauthenticated users' do
 | 
				
			||||||
    describe 'index' do
 | 
					    describe 'index' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, supporter_id: 1
 | 
					      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, supporter_id: 1, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'modify' do
 | 
					    describe 'modify' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ describe Nonprofits::PaymentsController, type: :controller do
 | 
				
			||||||
  include_context :shared_user_context
 | 
					  include_context :shared_user_context
 | 
				
			||||||
  describe 'rejects unauthenticated users' do
 | 
					  describe 'rejects unauthenticated users' do
 | 
				
			||||||
    describe 'get payments' do
 | 
					    describe 'get payments' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'export payments' do
 | 
					    describe 'export payments' do
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ describe Nonprofits::PaymentsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'show payments' do
 | 
					    describe 'show payments' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1'
 | 
					      include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1', without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'update' do
 | 
					    describe 'update' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@ describe Nonprofits::PayoutsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'index' do
 | 
					    describe 'index' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'show' do
 | 
					    describe 'show' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ describe Nonprofits::RecurringDonationsController, type: :controller do
 | 
				
			||||||
  include_context :shared_user_context
 | 
					  include_context :shared_user_context
 | 
				
			||||||
  describe 'rejects unauthenticated users' do
 | 
					  describe 'rejects unauthenticated users' do
 | 
				
			||||||
    describe 'index' do
 | 
					    describe 'index' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'export' do
 | 
					    describe 'export' do
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ describe Nonprofits::RecurringDonationsController, type: :controller do
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'show' do
 | 
					    describe 'show' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1'
 | 
					      include_context :open_to_np_associate, :get, :show, nonprofit_id: :__our_np, id: '1', without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'destroy' do
 | 
					    describe 'destroy' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ describe Nonprofits::SupportersController, type: :controller do
 | 
				
			||||||
  include_context :shared_user_context
 | 
					  include_context :shared_user_context
 | 
				
			||||||
  describe 'rejects unauthenticated users' do
 | 
					  describe 'rejects unauthenticated users' do
 | 
				
			||||||
    describe 'index' do
 | 
					    describe 'index' do
 | 
				
			||||||
      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np
 | 
					      include_context :open_to_np_associate, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'index_metrics' do
 | 
					    describe 'index_metrics' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,7 @@ describe NonprofitsController, type: :controller do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'dashboard' do
 | 
					      describe 'dashboard' do
 | 
				
			||||||
        include_context :open_to_np_associate, :get, :dashboard, id: :__our_np
 | 
					        include_context :open_to_np_associate, :get, :dashboard, id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'dashboard_metrics' do
 | 
					      describe 'dashboard_metrics' do
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@ describe NonprofitsController, type: :controller do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'open to all' do
 | 
					    describe 'open to all' do
 | 
				
			||||||
      describe 'show' do
 | 
					      describe 'show' do
 | 
				
			||||||
        include_context :open_to_all, :get, :show, id: :__our_np
 | 
					        include_context :open_to_all, :get, :show, id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'create' do
 | 
					      describe 'create' do
 | 
				
			||||||
| 
						 | 
					@ -55,11 +55,11 @@ describe NonprofitsController, type: :controller do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'btn' do
 | 
					      describe 'btn' do
 | 
				
			||||||
        include_context :open_to_all, :get, :btn, id: :__our_np
 | 
					        include_context :open_to_all, :get, :btn, id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'supporter_form' do
 | 
					      describe 'supporter_form' do
 | 
				
			||||||
        include_context :open_to_all, :get, :supporter_form, id: :__our_np
 | 
					        include_context :open_to_all, :get, :supporter_form, id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'custom_supporter' do
 | 
					      describe 'custom_supporter' do
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,7 @@ describe NonprofitsController, type: :controller do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'donate' do
 | 
					      describe 'donate' do
 | 
				
			||||||
        include_context :open_to_all, :get, :donate, id: :__our_np
 | 
					        include_context :open_to_all, :get, :donate, id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'search' do
 | 
					      describe 'search' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,17 +13,17 @@ describe ProfilesController, type: :controller do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'fundraisers' do
 | 
					      describe 'fundraisers' do
 | 
				
			||||||
        include_context :open_to_profile_owner, :get, :fundraisers, id: :__our_profile
 | 
					        include_context :open_to_profile_owner, :get, :fundraisers, id: :__our_profile, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'donations_history' do
 | 
					      describe 'donations_history' do
 | 
				
			||||||
        include_context :open_to_profile_owner, :get, :donations_history, id: :__our_profile
 | 
					        include_context :open_to_profile_owner, :get, :donations_history, id: :__our_profile, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe 'open to all' do
 | 
					    describe 'open to all' do
 | 
				
			||||||
      describe 'show' do
 | 
					      describe 'show' do
 | 
				
			||||||
        include_context :open_to_all, :get, :show, id: :__our_np
 | 
					        include_context :open_to_all, :get, :show, id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ describe RecurringDonationsController, type: :controller do
 | 
				
			||||||
    include_context :shared_user_context
 | 
					    include_context :shared_user_context
 | 
				
			||||||
    describe 'open to all (note: edit token is checked inside methods)' do
 | 
					    describe 'open to all (note: edit token is checked inside methods)' do
 | 
				
			||||||
      describe 'edit' do
 | 
					      describe 'edit' do
 | 
				
			||||||
        include_context :open_to_all, :get, :edit, nonprofit_id: :__our_np, id: '1'
 | 
					        include_context :open_to_all, :get, :edit, nonprofit_id: :__our_np, id: '1', without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'destroy' do
 | 
					      describe 'destroy' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ describe SettingsController, type: :controller do
 | 
				
			||||||
    include_context :shared_user_context
 | 
					    include_context :shared_user_context
 | 
				
			||||||
    describe 'rejects unauthorized users' do
 | 
					    describe 'rejects unauthorized users' do
 | 
				
			||||||
      describe 'index' do
 | 
					      describe 'index' do
 | 
				
			||||||
        include_context :open_to_registered, :get, :index, nonprofit_id: :__our_np
 | 
					        include_context :open_to_registered, :get, :index, nonprofit_id: :__our_np, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ describe SuperAdminsController, type: :controller do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'index' do
 | 
					      describe 'index' do
 | 
				
			||||||
        include_context :open_to_super_admin, :get, :index
 | 
					        include_context :open_to_super_admin, :get, :index, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,7 +85,8 @@ RSpec.shared_context :shared_user_context do
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def accept(user_to_signin, method, action, *args)
 | 
					  def accept(user_to_signin, method, action, *args)
 | 
				
			||||||
    without_json_response = %i[cancellation all_npos edit confirmation peer_to_peer advanced guided basic donations_history fundraisers donate supporter_form btn dashboard stats].include?(action)
 | 
					    # TODO: Extract into method args verification
 | 
				
			||||||
 | 
					    without_json_response = method_has_json_view?(args)
 | 
				
			||||||
    request.accept = 'application/json' unless without_json_response
 | 
					    request.accept = 'application/json' unless without_json_response
 | 
				
			||||||
    sign_in user_to_signin if user_to_signin
 | 
					    sign_in user_to_signin if user_to_signin
 | 
				
			||||||
    # allows us to run the helpers but ignore what the controller action does
 | 
					    # allows us to run the helpers but ignore what the controller action does
 | 
				
			||||||
| 
						 | 
					@ -114,6 +115,17 @@ RSpec.shared_context :shared_user_context do
 | 
				
			||||||
    { params: args.reduce({}, :merge) }
 | 
					    { params: args.reduce({}, :merge) }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def method_has_json_view?(*args)
 | 
				
			||||||
 | 
					    args.collect do |items|
 | 
				
			||||||
 | 
					      if items.kind_of?(Array)
 | 
				
			||||||
 | 
					        items.each do |k, v|
 | 
				
			||||||
 | 
					          return k[:without_json_view] if k.kind_of?(Hash) && k[:without_json_view]
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    return false
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def fix_args(*args)
 | 
					  def fix_args(*args)
 | 
				
			||||||
    replacements = {
 | 
					    replacements = {
 | 
				
			||||||
      __our_np: nonprofit.id,
 | 
					      __our_np: nonprofit.id,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ describe TicketsController, type: :controller do
 | 
				
			||||||
    include_context :shared_user_context
 | 
					    include_context :shared_user_context
 | 
				
			||||||
    describe 'rejects unauthorized users' do
 | 
					    describe 'rejects unauthorized users' do
 | 
				
			||||||
      describe 'index' do
 | 
					      describe 'index' do
 | 
				
			||||||
        include_context :open_to_event_editor, :get, :index, nonprofit_id: :__our_np, event_id: :__our_event
 | 
					        include_context :open_to_event_editor, :get, :index, nonprofit_id: :__our_np, event_id: :__our_event, without_json_view: true
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      describe 'update' do
 | 
					      describe 'update' do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue