Sha256: 339d8666ba2ef18959bba0b209b90427f4baf5cabce42c0216f7e83fe3a15bf7
Contents?: true
Size: 975 Bytes
Versions: 6
Compression:
Stored size: 975 Bytes
Contents
require "spec_helper" #Setup test specific ApplicationController class Account; end # this is so the spec will work in isolation class ApplicationController < ActionController::Base include Rails.application.routes.url_helpers set_current_tenant_by_subdomain end # Start testing describe ApplicationController, :type => :controller do controller do def index render :text => "custom called" end end it 'Finds the correct tenant with a subdomain.example.com' do @request.host = "account1.example.com" expect(Account).to receive(:where).with({subdomain: 'account1'}) {['account1']} get :index expect(ActsAsTenant.current_tenant).to eq 'account1' end it 'Finds the correct tenant with a www.subdomain.example.com' do @request.host = "www.account1.example.com" expect(Account).to receive(:where).with({subdomain: 'account1'}) {['account1']} get :index expect(ActsAsTenant.current_tenant).to eq 'account1' end end
Version data entries
6 entries across 6 versions & 1 rubygems