5 require 'can_has_fixtures'
7 # Add the dependency in a before_app_loads hook
8 Merb::BootLoader.before_app_loads { require(File.join(File.dirname(__FILE__), '..', 'lib', 'merb-E-mart')) }
10 DataMapper.setup(:default, 'sqlite3::memory:')
12 # Using Merb.root below makes sure that the correct root is set for
13 # - testing standalone, without being installed as a gem and no host application
14 # - testing from within the host application; its root will be used
15 Merb.start_environment(
18 :environment => ENV['MERB_ENV'] || 'test',
19 :merb_root => Merb.root
26 # The absolute path to the current slice
27 def current_slice_root
28 @current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
31 # Whether the specs are being run from a host application or standalone
40 Spec::Runner.configure do |config|
41 config.include(Merb::Test::ViewHelper)
42 config.include(Merb::Test::RouteHelper)
43 config.include(Merb::Test::ControllerHelper)
44 config.include(Merb::Test::SliceHelper)
47 require File.join(File.dirname(__FILE__), 'spec_fixtures')
50 def country_code(options = {:used => true, :unique => true})
51 code = 2.of {('a'..'z').random}.to_s until satisfies?(code, options)
53 @@used << code if options[:used]
58 "#{rand(100_000)} #{word(:max => 75)} #{%w[st rd ln ave pkwy].random}"
62 "#{(100..999).random}-#{(100..999).random}-#{(0..9999).random}"
66 module MockUploadProcessor
70 Upload.send :include, MockUploadProcessor