Sha256: 581afdd9f11a292e22a3acd932bab98f3fc35ddf9567403373e58a0c9d4c1ef6
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' 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 if Rails::VERSION::MAJOR >= 5 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activerecord-multi-tenant-0.3.2 | spec/activerecord-multi-tenant/controller_extensions_spec.rb |
activerecord-multi-tenant-0.3.1 | spec/activerecord-multi-tenant/controller_extensions_spec.rb |