Sha256: d10e248d99837da68882681a88908f7de1b822ca48eaa80524d9612d0503cda9

Contents?: true

Size: 877 Bytes

Versions: 3

Compression:

Stored size: 877 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 database_names default_database}.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

3 entries across 3 versions & 1 rubygems

Version Path
apartment-0.23.2 spec/support/requirements.rb
apartment-0.23.1 spec/support/requirements.rb
apartment-0.23.0 spec/support/requirements.rb