mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
26 lines
537 B
Ruby
26 lines
537 B
Ruby
module RailsVersions
|
|
def rails_version
|
|
Gem::Version.new(Rails::VERSION::STRING)
|
|
end
|
|
|
|
def rails_3_x?
|
|
Gem::Requirement.new('~> 3.0').satisfied_by?(rails_version)
|
|
end
|
|
|
|
def rails_4_x?
|
|
Gem::Requirement.new('~> 4.0').satisfied_by?(rails_version)
|
|
end
|
|
|
|
def rails_gte_4_1?
|
|
Gem::Requirement.new('>= 4.1').satisfied_by?(rails_version)
|
|
end
|
|
|
|
def active_record_supports_enum?
|
|
defined?(::ActiveRecord::Enum)
|
|
end
|
|
end
|
|
|
|
RSpec.configure do |config|
|
|
config.include(RailsVersions)
|
|
config.extend(RailsVersions)
|
|
end
|