Sha256: b1c3f619a505c5e7041cda10e0cb890cd498f2fd9222cc2c904750e8d0ebe1b2

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 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.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.suffix = nil }
      let(:schema_name) { 'boom' }
      it { should == 'boom' }
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storey-2.0.2 spec/storey/suffixifier_spec.rb
storey-2.0.1 spec/storey/suffixifier_spec.rb
storey-2.0.0 spec/storey/suffixifier_spec.rb