Sha256: 4f44bb42903426fd195b2b2d52afdf1f24d85186d67fdae821f6e10d8b74b285

Contents?: true

Size: 953 Bytes

Versions: 4

Compression:

Stored size: 953 Bytes

Contents

require 'spec_helper'

describe 'Storey', '#default_search_path' do

  context "when #default_search_path has not been set before" do
    it "defaults to the current schema" do
      Storey.create "anotherschema"

      # A bit of a hack, but set the @@default_search_path so we can test
      # the scenario when no path has been set
      Storey.class_variable_set("@@default_search_path", nil)

      Storey.switch "anotherschema"

      expect(Storey.default_search_path).to eq '"$user",public'
    end
  end

  it 'includes the persistent schemas' do
    Storey.configuration.persistent_schemas = %w(hello there)
    expect(Storey.default_search_path).to eq '"$user",public,hello,there'
  end

  context 'when the persistent schemas includes `public`' do
    it 'has one instance of public' do
      Storey.configuration.persistent_schemas = %w(public hello)
      expect(Storey.default_search_path).to eq '"$user",public,hello'
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
storey-2.2.0 spec/storey/default_search_path_spec.rb
storey-2.1.2 spec/storey/default_search_path_spec.rb
storey-2.1.1 spec/storey/default_search_path_spec.rb
storey-2.1.0 spec/storey/default_search_path_spec.rb