Module: Merb::Test::RouteHelper

Includes:
RequestHelper
Included in:
RSpec::Core::ExampleGroup, Spec::Matchers::MatcherDSL
Defined in:
merb-core/lib/merb-core/test/helpers/route_helper.rb

Instance Method Summary (collapse)

Methods included from RequestHelper

#build_request, #check_request_for_route, #describe_input, #describe_request, #dispatch_request, #dispatch_to, #dispatch_with_basic_authentication_to, #fake_request, #merge_controller_and_action, #mock_request, #status_code, #with_cookies

Instance Method Details

- (Hash) request_to(path, method = :get, env = {})

Returns A hash containing the controller and action along with any parameters

Parameters:

  • path (#to_s)

    The URL of the request.

  • method (#to_sym) (defaults to: :get)

    HTTP request method.

  • env (Hash) (defaults to: {})

    Additional parameters for the request.

Returns:

  • (Hash)

    A hash containing the controller and action along with any parameters



23
24
25
26
27
28
# File 'merb-core/lib/merb-core/test/helpers/route_helper.rb', line 23

def request_to(path, method = :get, env = {})
  env[:request_method] ||= method.to_s.upcase
  env[:request_uri] = path

  check_request_for_route(build_request({}, env))
end

- (Object) resource(*args)

See Also:



13
14
15
16
# File 'merb-core/lib/merb-core/test/helpers/route_helper.rb', line 13

def resource(*args)
  args << @request_params || {}
  Merb::Router.resource(*args)
end

- (Object) url(*args)

See Also:



7
8
9
10
# File 'merb-core/lib/merb-core/test/helpers/route_helper.rb', line 7

def url(*args)
  args << (@request_params || {})
  Merb::Router.url(*args)
end