Sha256: d7fde200665fddccd42fd41a0208d1820bcbb1521589a9c8b6ee004b1abb622e

Contents?: true

Size: 685 Bytes

Versions: 2

Compression:

Stored size: 685 Bytes

Contents

require 'support/matchers/base'

module ChronoTest::Matchers

  module Schema
    class BeInSchema < ChronoTest::Matchers::Base

      def initialize(expected)
        @expected = expected
        @expected = '"$user", public' if @expected == :default
      end

      def description
        'be in schema'
      end

      def failure_message_for_should
        "expected to be in schema #@expected, but was in #@current"
      end

      def matches?(*)
        @current = select_value(<<-SQL, [], 'Current schema')
          SHOW search_path
        SQL

        @current == @expected
      end
    end

    def be_in_schema(schema)
      BeInSchema.new(schema)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chrono_model-0.8.2 spec/support/matchers/schema.rb
chrono_model-0.8.0 spec/support/matchers/schema.rb