Sha256: 0fb13e9b2a670db1ed550062200164870b31d7c1c906b85287eee3c434f6f6e3
Contents?: true
Size: 760 Bytes
Versions: 1
Compression:
Stored size: 760 Bytes
Contents
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 rails_version if Rails.version.to_i < 3 :rails2 else :rails3 end end def rails_loaded? defined?(Rails) end def new_mock(*args) rspec_root.const_get(:Mocks).const_get(:Mock).new(*args) end def rspec_root (defined?(RSpec) ? RSpec : Spec) end def rspec_matcher_registry rspec_root.const_get(:Matchers) end def define_matcher(*args, &block) rspec_matcher_registry.define(*args, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec_candy-0.2.2 | lib/rspec_candy/switcher.rb |