Sha256: 274263c45b7326229b9874894bbb54c940974c52bd328370a8f4a488563d3020

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe Storey, '#schema_exists?' do
  context 'the schema is the default search path' do
    it 'should return true' do
      expect(Storey.schema_exists?('"$user",public')).to be true
    end
  end

  context 'when there is no suffix' do
    context 'when the schema exists' do
      before do
        Storey.create 'hoo'
      end

      it 'should return true' do
        expect(Storey.schema_exists?('hoo')).to be true
      end
    end

    context 'when the schema does not exist' do
      it 'should return false' do
        expect(Storey.schema_exists?('boo')).to be false
      end
    end
  end

  context 'when there is a suffix' do
    context 'when the schema exists' do
      before do
        Storey.suffix = '_boo'
        Storey.create 'croo'
      end

      it 'should return true' do
        expect(Storey.schema_exists?('croo')).to be true
      end
    end

    context 'when the schema does not exist' do
      it 'should return false' do
        expect(Storey.schema_exists?('croo')).to be false
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
storey-2.0.2 spec/storey/schema_exists_spec.rb
storey-2.0.1 spec/storey/schema_exists_spec.rb
storey-2.0.0 spec/storey/schema_exists_spec.rb
storey-1.0.0 spec/storey/schema_exists_spec.rb