Sha256: d6c93a45d85c8039cf9814b83e1f95110f4ee075105a871e249885b85dcf1a57

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

require 'rubygems'
require 'merb-core'
require 'merb-slices'
require 'spec'

# Add merb_screw_unit.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_screw_unit.rb')

# 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',
  :merb_root => Merb.root,
  :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 == ::MerbScrewUnit.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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
merb_screw_unit-0.9.6 spec/spec_helper.rb
merb_screw_unit-0.9.7 spec/spec_helper.rb
merb_screw_unit-0.9.4 spec/spec_helper.rb
merb_screw_unit-0.9.5 spec/spec_helper.rb
merb_screw_unit-0.9.8 spec/spec_helper.rb