Sha256: 7e56cb51d7cbfdd393b83a231524897d849ab6a43f03274ede6cafec82f3818a

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Storey::Suffixifier do

  describe '#suffixify' do
    subject(:schemas) do
      described_class.new(schema_name).suffixify
    end

    context 'suffixes have been turned on' do
      before { Storey.configuration.suffix = '_suff' }

      context 'when the schema given has not already been suffixified' do
        let(:schema_name) { 'boom' }
        it { should == 'boom_suff' }
      end

      context 'when the schema given has already been suffixified' do
        let(:schema_name) { 'boom_suff' }
        it { should == 'boom_suff' }
      end

      context 'when given comma separated schemas (with inconsistent spaces)' do
        let(:schema_name) { '"$user", public,foo, bar, baz' }

        it 'should return a comma separted schema string with the non-native schemas suffixified' do
          subject.should == '"$user", public, foo_suff, bar_suff, baz_suff'
        end
      end
    end

    context 'suffixes are not on' do
      before { Storey.configuration.suffix = nil }
      let(:schema_name) { 'boom' }
      it { should == 'boom' }
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

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