Sha256: 10d64e940864723bf99af514da270846d6239370e54e84563156259e75bae34d

Contents?: true

Size: 928 Bytes

Versions: 4

Compression:

Stored size: 928 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::Database.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

4 entries across 4 versions & 1 rubygems

Version Path
apartment-0.24.3 spec/examples/connection_adapter_examples.rb
apartment-0.24.2 spec/examples/connection_adapter_examples.rb
apartment-0.24.1 spec/examples/connection_adapter_examples.rb
apartment-0.24.0 spec/examples/connection_adapter_examples.rb