Merb::Test::SliceHelper

Public Instance Methods

current_slice_root() click to toggle source

The absolute path to the current slice

# File lib/generators/templates/full/spec/spec_helper.rb, line 28
def current_slice_root
  @current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
end
dismount_slice() click to toggle source
# File lib/generators/templates/full/spec/spec_helper.rb, line 55
def dismount_slice
  Merb::Router.reset! if standalone?
end
standalone?() click to toggle source

Whether the specs are being run from a host application or standalone

# File lib/generators/templates/full/spec/spec_helper.rb, line 33
      def standalone?
        Merb.root == ::<% module_name %>.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(:<%= module_name %>, "<%= base_name %>") } if standalone?
  end

[Validate]

Generated with the Darkfish Rdoc Generator 2.