Sha256: bafbdba77f4080afac0c4ee5b970129fbf5ab97c47ebffdca7456969de8d4331

Contents?: true

Size: 965 Bytes

Versions: 7

Compression:

Stored size: 965 Bytes

Contents

module Merb
  module Test
    module RouteHelper
      include RequestHelper
      
      # Mimics the url method available to controllers.
      #
      # ==== Parameters
      # name<~to_sym>:: The name of the URL to generate.
      # params<Hash>:: Parameters for the route generation.
      #
      # ==== Returns
      # String:: The generated URL.
      def url(name, params={})
        Merb::Router.generate(name, params)
      end
      
      # ==== Parameters
      # path<~to_string>:: The URL of the request.
      # method<~to_sym>:: HTTP request method.
      # env<Hash>:: Additional parameters for the request.
      #
      # ==== Returns
      # Hash:: A hash containing the controller and action along with any parameters
      def request_to(path, method = :get, env = {})
        env[:request_method] ||= method.to_s.upcase
        env[:request_uri] = path
        
        check_request_for_route(fake_request(env))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
thorero-0.9.4.5 lib/merb-core/test/helpers/route_helper.rb
merb-core-0.9.2 lib/merb-core/test/helpers/route_helper.rb
merb-core-0.9.5 lib/merb-core/test/helpers/route_helper.rb
merb-core-0.9.4 lib/merb-core/test/helpers/route_helper.rb
merb-core-0.9.3 lib/merb-core/test/helpers/route_helper.rb
merb-core-0.9.6 lib/merb-core/test/helpers/route_helper.rb
thorero-core-0.9.4.6 lib/merb-core/test/helpers/route_helper.rb