Sha256: 68d29aa8de54dd724f582187c12108f275eac83396d8d26c80bdb0db6d6f3aaa

Contents?: true

Size: 629 Bytes

Versions: 8

Compression:

Stored size: 629 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 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

8 entries across 8 versions & 1 rubygems

Version Path
chrono_model-0.5.3 spec/support/matchers/schema.rb
chrono_model-0.5.2 spec/support/matchers/schema.rb
chrono_model-0.5.1 spec/support/matchers/schema.rb
chrono_model-0.5.0 spec/support/matchers/schema.rb
chrono_model-0.5.0.beta spec/support/matchers/schema.rb
chrono_model-0.4.0 spec/support/matchers/schema.rb
chrono_model-0.3.1 spec/support/matchers/schema.rb
chrono_model-0.3.0 spec/support/matchers/schema.rb