Sha256: 154de2a50659a63364e4bfd02a370a25bf08d0b314d4bbfa130805ce53133ada

Contents?: true

Size: 792 Bytes

Versions: 20

Compression:

Stored size: 792 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
        "expected to be in schema #@expected, but was in #@current"
      end

      def failure_message_when_negated
        "expected to be in schema #@current, but was in #@expected"
      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

20 entries across 20 versions & 1 rubygems

Version Path
chrono_model-1.2.2 spec/support/matchers/schema.rb
chrono_model-1.2.1 spec/support/matchers/schema.rb
chrono_model-1.2.0 spec/support/matchers/schema.rb
chrono_model-1.1.0 spec/support/matchers/schema.rb
chrono_model-1.0.1 spec/support/matchers/schema.rb
chrono_model-0.13.2 spec/support/matchers/schema.rb
chrono_model-1.0.0 spec/support/matchers/schema.rb
chrono_model-0.13.1 spec/support/matchers/schema.rb
chrono_model-0.13.0 spec/support/matchers/schema.rb
chrono_model-0.12.3 spec/support/matchers/schema.rb
chrono_model-0.12.2 spec/support/matchers/schema.rb
chrono_model-0.12.1 spec/support/matchers/schema.rb
chrono_model-0.12.0 spec/support/matchers/schema.rb
chrono_model-0.11.1 spec/support/matchers/schema.rb
chrono_model-0.11.0 spec/support/matchers/schema.rb
chrono_model-0.10.1 spec/support/matchers/schema.rb
chrono_model-0.10.0 spec/support/matchers/schema.rb
chrono_model-0.9.2 spec/support/matchers/schema.rb
chrono_model-0.9.1 spec/support/matchers/schema.rb
chrono_model-0.9.0 spec/support/matchers/schema.rb