Sha256: 9d5fdb4596af9d2cb26b525b67342f970f8d59175ac41a70c3c92f41071b0342

Contents?: true

Size: 778 Bytes

Versions: 6

Compression:

Stored size: 778 Bytes

Contents

require "spec_helper"

#Setup test specific ApplicationController
class Account
  attr_accessor :name
end

class ApplicationController2 < ActionController::Base
  include Rails.application.routes.url_helpers
  set_current_tenant_through_filter
  before_filter :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

# Start testing
describe ApplicationController2, :type => :controller do
  controller do
    def index
      render :text => "custom called"
    end
  end

  it 'Finds the correct tenant using the filter command' do
    get :index
    expect(ActsAsTenant.current_tenant.name).to eq 'account1'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
acts_as_tenant-0.4.1 spec/acts_as_tenant/tenant_by_filter_spec.rb
acts_as_tenant-0.4.0 spec/acts_as_tenant/tenant_by_filter_spec.rb
acts_as_tenant-0.3.9 spec/acts_as_tenant/tenant_by_filter_spec.rb
acts_as_tenant-0.3.8 spec/acts_as_tenant/tenant_by_filter_spec.rb
acts_as_tenant-0.3.7 spec/acts_as_tenant/tenant_by_filter_spec.rb
acts_as_tenant-0.3.6 spec/acts_as_tenant/tenant_by_filter_spec.rb