Sha256: a38a265237091232969b0f1dace14a732f655691adfb83ca2724582781b1ab8a

Contents?: true

Size: 923 Bytes

Versions: 7

Compression:

Stored size: 923 Bytes

Contents

require 'spec_helper'

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

  let(:default_database){ 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

7 entries across 7 versions & 1 rubygems

Version Path
apartment-0.19.0 spec/examples/db_adapter_examples.rb
apartment-0.18.0 spec/examples/db_adapter_examples.rb
apartment-0.17.3 spec/examples/db_adapter_examples.rb
apartment-0.17.2 spec/examples/db_adapter_examples.rb
apartment-0.17.1 spec/examples/db_adapter_examples.rb
apartment-0.17.0 spec/examples/db_adapter_examples.rb
apartment-0.16.0 spec/examples/db_adapter_examples.rb