lib/rspec_candy/switcher.rb in rspec_candy-0.4.0 vs lib/rspec_candy/switcher.rb in rspec_candy-0.4.1
- old
+ new
@@ -1,24 +1,18 @@
module RSpecCandy
module Switcher
extend self
- # def rspec_version
- # if defined?(RSpec::Core)
- # :rspec2
- # elsif defined?(Spec)
- # :rspec1
- # else
- # raise 'Cannot determine RSpec version'
- # end
- # end
-
def rspec_version
- if defined?(Spec)
- 1
- else
+ begin
require 'rspec/version'
RSpec::Version::STRING.to_i
+ rescue LoadError
+ if defined?(Spec)
+ 1
+ else
+ raise 'Cannot determine RSpec version'
+ end
end
end
def active_record_version
ActiveRecord::VERSION::MAJOR