Sha256: 7aa1058d414596e874a5b99cdf072b0989cf1ddebb5e1ff14f8b9a6f7c362956
Contents?: true
Size: 2 KB
Versions: 4
Compression:
Stored size: 2 KB
Contents
require 'spec_helper' require 'apartment/adapters/postgresql_adapter' describe Apartment::Adapters::PostgresqlAdapter, database: :postgresql do unless defined?(JRUBY_VERSION) subject{ Apartment::Tenant.postgresql_adapter config } context "using schemas with schema.rb" do before{ Apartment.use_schemas = true } # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test def tenant_names ActiveRecord::Base.connection.execute("SELECT nspname FROM pg_namespace;").collect { |row| row['nspname'] } end let(:default_tenant) { subject.process { ActiveRecord::Base.connection.schema_search_path.gsub('"', '') } } it_should_behave_like "a generic apartment adapter" it_should_behave_like "a schema based apartment adapter" end context "using schemas with SQL dump" do before{ Apartment.use_schemas = true; Apartment.use_sql = true } # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test def tenant_names ActiveRecord::Base.connection.execute("SELECT nspname FROM pg_namespace;").collect { |row| row['nspname'] } end let(:default_tenant) { subject.process { ActiveRecord::Base.connection.schema_search_path.gsub('"', '') } } it_should_behave_like "a generic apartment adapter" it_should_behave_like "a schema based apartment adapter" end context "using connections" do before{ Apartment.use_schemas = false } # Not sure why, but somehow using let(:tenant_names) memoizes for the whole example group, not just each test def tenant_names connection.execute("select datname from pg_database;").collect { |row| row['datname'] } end let(:default_tenant) { subject.process { ActiveRecord::Base.connection.current_database } } it_should_behave_like "a generic apartment adapter" it_should_behave_like "a connection based apartment adapter" end end end
Version data entries
4 entries across 4 versions & 1 rubygems