Class: Spec::Rails::Example::RoutingHelpers::RouteFor

Inherits:
Object
  • Object
show all
Includes:
ParamsFromQueryString
Defined in:
lib/spec/rails/example/routing_helpers.rb

Instance Method Summary collapse

Methods included from ParamsFromQueryString

#params_from_querystring

Constructor Details

#initialize(example, options) ⇒ RouteFor

Returns a new instance of RouteFor.



19
20
21
# File 'lib/spec/rails/example/routing_helpers.rb', line 19

def initialize(example, options)
  @example, @options = example, options
end

Instance Method Details

#==(expected) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/spec/rails/example/routing_helpers.rb', line 23

def ==(expected)
  if Hash === expected
    path, querystring = expected[:path].split('?')
    path = expected.merge(:path => path)
  else
    path, querystring = expected.split('?')
  end
  params = querystring.blank? ? {} : @example.params_from_querystring(querystring)
  @example.assert_recognizes(@options, path, params)
  true
end