Sha256: 53201b187cbe9fda4ba7c077d45d89280f9e74ff7a0f6c211652c5cf517d6a06

Contents?: true

Size: 661 Bytes

Versions: 2

Compression:

Stored size: 661 Bytes

Contents

require 'active_record'

module TestUtils
  extend self

  ACTIVE_RECORD_3_MINIMUM_VERSION = Gem::Version.new('3.2.0')
  ACTIVE_RECORD_4_MINIMUM_VERSION = Gem::Version.new('4.0.0')
  ACTIVE_RECORD_5_MINIMUM_VERSION = Gem::Version.new('5.0.0')

  def active_record_version
    @active_record_version ||= Gem.loaded_specs['activerecord'].version
  end

  def is_active_record_3?
    ACTIVE_RECORD_3_MINIMUM_VERSION <= active_record_version && active_record_version < ACTIVE_RECORD_4_MINIMUM_VERSION
  end

  def is_active_record_4?
    ACTIVE_RECORD_4_MINIMUM_VERSION <= active_record_version && active_record_version < ACTIVE_RECORD_5_MINIMUM_VERSION
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
attr_initializable-0.1.2 test/test_utils.rb
attr_initializable-0.1.0 test/test_utils.rb