Sha256: 54d1b1c125592761c511c2153c31fb5867440f547b3a1ae5011ae4ebd0fefe88

Contents?: true

Size: 926 Bytes

Versions: 5

Compression:

Stored size: 926 Bytes

Contents

require 'spec_helper'

shared_examples_for "a connection based apartment adapter" do
  include Apartment::Spec::AdapterRequirements

  let(:default_tenant){ subject.process{ ActiveRecord::Base.connection.current_database } }

  describe "#init" do
    it "should process model exclusions" do
      Apartment.configure do |config|
        config.excluded_models = ["Company"]
      end
      Apartment::Tenant.init

      Company.connection.object_id.should_not == ActiveRecord::Base.connection.object_id
    end
  end

  describe "#drop" do
    it "should raise an error for unknown database" do
      expect {
        subject.drop 'unknown_database'
      }.to raise_error(Apartment::DatabaseNotFound)
    end
  end

  describe "#switch" do
    it "should raise an error if database is invalid" do
      expect {
        subject.switch 'unknown_database'
      }.to raise_error(Apartment::DatabaseNotFound)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
apartment-0.26.1 spec/examples/connection_adapter_examples.rb
apartment-0.26.0 spec/examples/connection_adapter_examples.rb
apartment-0.25.2 spec/examples/connection_adapter_examples.rb
apartment-0.25.1 spec/examples/connection_adapter_examples.rb
apartment-0.25.0 spec/examples/connection_adapter_examples.rb