Fix for Ruby 1.8.6 compatibility
[merb_global.git] / spec / spec_helper.rb
blob41bb28d508c19428edaf9a3339503a14cad81be8
1 require 'rubygems'
3 # Providers
4 def load_provider_lib(*libs)
5   begin
6     libs.each {|lib| require lib}
7     true
8   rescue Gem::LoadError => e
9     warn "Could not load #{lib}: #{e}"
10     false
11   end
12 end
14 HAS_AR      = load_provider_lib 'activerecord'
15 HAS_DM      = load_provider_lib 'dm-core', 'dm-validations', 'dm-aggregates'
16 HAS_GETTEXT = load_provider_lib 'gettext'
17 HAS_SEQUEL  = load_provider_lib 'sequel'
19 require 'merb-core'
21 Merb::Plugins.config[:merb_global] = {
22   :provider => 'mock',
23   :localedir => File.join('spec', 'locale')
26 require 'pathname'
27 require Pathname(__FILE__).dirname.parent.expand_path.to_s + '/lib/merb_global'
29 Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test')
31 require 'spec'
33 Spec::Runner.configure do |config|
34   config.include(Merb::Test::ControllerHelper)
35   config.mock_with :mocha
36 end