Class: Shoulda::ActionController::Matchers::RouteMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda/action_controller/matchers/route_matcher.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, path, context) ⇒ RouteMatcher

Returns a new instance of RouteMatcher.



31
32
33
34
35
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 31

def initialize(method, path, context)
  @method  = method
  @path    = path
  @context = context
end

Instance Attribute Details

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



54
55
56
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 54

def failure_message
  @failure_message
end

#negative_failure_messageObject (readonly)

Returns the value of attribute negative_failure_message.



54
55
56
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 54

def negative_failure_message
  @negative_failure_message
end

Instance Method Details

#descriptionObject



56
57
58
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 56

def description
  "route #{@method.to_s.upcase} #{@path} to/from #{@params.inspect}"
end

#in_context(context) ⇒ Object



43
44
45
46
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 43

def in_context(context)
  @context = context
  self
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 48

def matches?(controller)
  @controller = controller
  guess_controller!
  route_recognized?
end

#to(params) ⇒ Object



37
38
39
40
41
# File 'lib/shoulda/action_controller/matchers/route_matcher.rb', line 37

def to(params)
  @params = params
  stringify_params!
  self
end