Sha256: cc220f680649fa28fc28a614ce1fa4f58e29c86e1331b7660050093df9f215e4
Contents?: true
Size: 1.59 KB
Versions: 7
Compression:
Stored size: 1.59 KB
Contents
require 'rubygems' require 'merb-core' require 'merb-slices' require 'spec' # Add merb-admin.rb to the search path Merb::Plugins.config[:merb_slices][:auto_register] = true Merb::Plugins.config[:merb_slices][:search_path] = File.join(File.dirname(__FILE__), '..', 'lib', 'merb-admin.rb') # Require merb-admin.rb explicitly so any dependencies are loaded require Merb::Plugins.config[:merb_slices][:search_path] # Using Merb.root below makes sure that the correct root is set for # - testing standalone, without being installed as a gem and no host application # - testing from within the host application; its root will be used Merb.start_environment( :testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test', :session_store => 'memory' ) module Merb module Test module SliceHelper # The absolute path to the current slice def current_slice_root @current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..')) end # Whether the specs are being run from a host application or standalone def standalone? Merb.root == ::MerbAdmin.root end end end end Spec::Runner.configure do |config| config.include(Merb::Test::ViewHelper) config.include(Merb::Test::RouteHelper) config.include(Merb::Test::ControllerHelper) config.include(Merb::Test::SliceHelper) end # You can add your own helpers here # Merb::Test.add_helpers do def mount_slice Merb::Router.prepare { add_slice(:MerbAdmin) } if standalone? end def dismount_slice Merb::Router.reset! if standalone? end end
Version data entries
7 entries across 7 versions & 1 rubygems