Sha256: 0d9df8ceffff1c85d895c415a3de20fb85a9807da22f39c4d499bc4b9447c4e2

Contents?: true

Size: 871 Bytes

Versions: 21

Compression:

Stored size: 871 Bytes

Contents

module Apartment
  module Spec

    #
    #   Define the interface methods required to
    #   use an adapter shared example
    #
    #
    module AdapterRequirements
      extend ActiveSupport::Concern

      included do
        before do
          subject.create(db1)
          subject.create(db2)
        end

        after do
          # Reset before dropping (can't drop a db you're connected to)
          subject.reset

          # sometimes we manually drop these schemas in testing, don't care if we can't drop, hence rescue
          subject.drop(db1) rescue true
          subject.drop(db2) rescue true
        end
      end

      %w{subject tenant_names default_tenant}.each do |method|
        define_method method do
          raise "You must define a `#{method}` method in your host group"
        end unless defined?(method)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
ros-apartment-2.3.0 spec/support/requirements.rb
ros-apartment-2.3.0.alpha2 spec/support/requirements.rb
ros-apartment-2.3.0.alpha1 spec/support/requirements.rb
apartment-2.2.1 spec/support/requirements.rb
apartment-2.2.0 spec/support/requirements.rb
apartment-2.1.0 spec/support/requirements.rb
apartment-2.0.0 spec/support/requirements.rb
apartment-1.2.0 spec/support/requirements.rb
apartment-1.1.0 spec/support/requirements.rb
apartment-1.0.2 spec/support/requirements.rb
apartment-1.0.1 spec/support/requirements.rb
apartment-1.0.0 spec/support/requirements.rb
apartment-0.26.1 spec/support/requirements.rb
apartment-0.26.0 spec/support/requirements.rb
apartment-0.25.2 spec/support/requirements.rb
apartment-0.25.1 spec/support/requirements.rb
apartment-0.25.0 spec/support/requirements.rb
apartment-0.24.3 spec/support/requirements.rb
apartment-0.24.2 spec/support/requirements.rb
apartment-0.24.1 spec/support/requirements.rb