Sha256: b60f4f6bf0b88ef3dd6ffed6d03f0995f703af5099a60b7ad577491af4eb944e

Contents?: true

Size: 1.34 KB

Versions: 17

Compression:

Stored size: 1.34 KB

Contents

#   Some shared contexts for specs

shared_context "with default schema", :default_schema => true do
  let(:default_schema){ Apartment::Test.next_db }

  before do
    Apartment::Test.create_schema(default_schema)
    Apartment.default_schema = default_schema
  end

  after do
    # resetting default_schema so we can drop and any further resets won't try to access droppped schema
    Apartment.default_schema = nil
    Apartment::Test.drop_schema(default_schema)
  end
end

# Some default setup for elevator specs
shared_context "elevators", elevator: true do
  let(:company1)  { mock_model(Company, database: db1).as_null_object }
  let(:company2)  { mock_model(Company, database: db2).as_null_object }

  let(:api)       { Apartment::Tenant }

  before do
    Apartment.reset # reset all config
    Apartment.seed_after_create = false
    Apartment.use_schemas = true
    api.reload!(config)
    api.create(db1)
    api.create(db2)
  end

  after do
    api.drop(db1)
    api.drop(db2)
  end
end

shared_context "persistent_schemas", :persistent_schemas => true do
  let(:persistent_schemas){ ['hstore', 'postgis'] }

  before do
    persistent_schemas.map{|schema| subject.create(schema) }
    Apartment.persistent_schemas = persistent_schemas
  end

  after do
    Apartment.persistent_schemas = []
    persistent_schemas.map{|schema| subject.drop(schema) }
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

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