Sha256: 77152e9855df7899eb9b5152028f986c4a07582964b88ca52b4bde04c7e542c9

Contents?: true

Size: 614 Bytes

Versions: 8

Compression:

Stored size: 614 Bytes

Contents

module UnitTests
  module ColumnTypeHelpers
    def self.configure_example_group(example_group)
      example_group.include(self)
    end

    def column_type_class_namespace
      if database_adapter == :postgresql
        ActiveRecord::ConnectionAdapters::PostgreSQL
      else
        ActiveRecord::Type
      end
    end

    def column_type_class_for(type)
      namespace =
        if type == :integer && database_adapter == :postgresql
          column_type_class_namespace::OID
        else
          column_type_class_namespace
        end

      namespace.const_get(type.to_s.camelize)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shoulda-matchers-3.1.3 spec/support/unit/helpers/column_type_helpers.rb
shoulda-matchers-4.0.0.rc1 spec/support/unit/helpers/column_type_helpers.rb
shoulda-matchers-3.1.2 spec/support/unit/helpers/column_type_helpers.rb
shoulda-matchers-3.1.1 spec/support/unit/helpers/column_type_helpers.rb
shoulda-matchers-3.1.0 spec/support/unit/helpers/column_type_helpers.rb
shoulda-matchers-3.0.1 spec/support/unit/helpers/column_type_helpers.rb
shoulda-matchers-3.0.0 spec/support/unit/helpers/column_type_helpers.rb
shoulda-matchers-3.0.0.rc1 spec/support/unit/helpers/column_type_helpers.rb