Sha256: 277d833b16199102b9dcb4bd438ef06dac446f01055bc29ec993cb474edd252f

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

describe Storey, "#schemas" do
  context "when suffix is set" do
    before do
      Storey.configuration.suffix = "_roboto"
    end

    it "should return an array of the schemas without the suffix by default" do
      Storey.create "mr"
      Storey.schemas.should include("mr")
    end

    it "should include the public schema by default" do
      Storey.schemas.should include("public")
    end

    it "should not include any postgres schemas" do
      Storey.schemas do |schema|
        schema.should_not include("pg_")
        schema.should_not == "information_schema"
      end
    end

    context "when suffix => true" do
      it "should return an array of the schemas with the suffix" do
        Storey.create "mr"
        Storey.schemas(:suffix => true).should include("mr_roboto")
      end
    end

    context "when suffix => false" do
      it "should return an array of the schemas without the suffix" do
        Storey.create "mr"
        Storey.schemas(:suffix => false).should include("mr")
      end
    end

    context "`:public` option" do
      context "when `public: true`" do
        it "returns an array of the schemas including the public schema" do
          expect(Storey.schemas(public: true)).to include("public")
        end
      end

      context "when `public: false`" do
        it "returns an array of the schemas without the public schema" do
          expect(Storey.schemas(public: false)).to_not include("public")
        end
      end

      context "when `public` is not set" do
        it "returns an array of the schemas including the public schema" do
          expect(Storey.schemas).to include("public")
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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