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
16 Merb.start_environment(
19 :environment => ENV['MERB_ENV'] || 'test',
20 :merb_root => Merb.root
27 # The absolute path to the current slice
28 def current_slice_root
29 @current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
32 # Whether the specs are being run from a host application or standalone
41 Spec::Runner.configure do |config|
42 config.include(Merb::Test::ViewHelper)
43 config.include(Merb::Test::RouteHelper)
44 config.include(Merb::Test::ControllerHelper)
45 config.include(Merb::Test::SliceHelper)
48 require File.join(File.dirname(__FILE__), 'spec_fixtures')
51 def country_code(options = {:used => true, :unique => true})
52 code = 2.of {('a'..'z').random}.to_s until satisfies?(code, options)
54 @@used << code if options[:used]
59 "#{rand(100_000)} #{word(:max => 75)} #{%w[st rd ln ave pkwy].random}"
63 "#{(100..999).random}-#{(100..999).random}-#{(0..9999).random}"