Sha256: 826c5595c35493a4c7330ba69cde03d1b4d7e95b0a4cef7b07ab85a0b2806188
Contents?: true
Size: 1.48 KB
Versions: 11
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' describe "Controller Extensions", type: :controller do class Account attr_accessor :name end class ApplicationController < ActionController::Base include Rails.application.routes.url_helpers set_current_tenant_through_filter before_action :your_method_that_finds_the_current_tenant def your_method_that_finds_the_current_tenant current_account = Account.new current_account.name = 'account1' set_current_tenant(current_account) end end describe ApplicationController, type: :controller do controller do def index render body: 'custom called' end end it 'Finds the correct tenant using the filter command' do get :index expect(MultiTenant.current_tenant.name).to eq 'account1' end end class APIApplicationController < ActionController::API include Rails.application.routes.url_helpers set_current_tenant_through_filter before_action :your_method_that_finds_the_current_tenant def your_method_that_finds_the_current_tenant current_account = Account.new current_account.name = 'account1' set_current_tenant(current_account) end end describe APIApplicationController, type: :controller do controller do def index render body: 'custom called' end end it 'Finds the correct tenant using the filter command' do get :index expect(MultiTenant.current_tenant.name).to eq 'account1' end end end
Version data entries
11 entries across 11 versions & 1 rubygems