Class: Shoulda::ActionController::Matchers::RedirectToMatcher

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url_or_description, context, &block) ⇒ RedirectToMatcher

Returns a new instance of RedirectToMatcher.


17
18
19
20
21
22
23
24
25
26
# File 'lib/shoulda/action_controller/matchers/redirect_to_matcher.rb', line 17

def initialize(url_or_description, context, &block)
  if block
    @url_block = block
    @location = @url_or_description
  else
    @url = url_or_description
    @location = @url
  end
  @context = context
end

Instance Attribute Details

#failure_messageObject (readonly)

Returns the value of attribute failure_message


38
39
40
# File 'lib/shoulda/action_controller/matchers/redirect_to_matcher.rb', line 38

def failure_message
  @failure_message
end

#negative_failure_messageObject (readonly)

Returns the value of attribute negative_failure_message


38
39
40
# File 'lib/shoulda/action_controller/matchers/redirect_to_matcher.rb', line 38

def negative_failure_message
  @negative_failure_message
end

Instance Method Details

#descriptionObject


40
41
42
# File 'lib/shoulda/action_controller/matchers/redirect_to_matcher.rb', line 40

def description
  "redirect to #{@location}"
end

#in_context(context) ⇒ Object


28
29
30
31
# File 'lib/shoulda/action_controller/matchers/redirect_to_matcher.rb', line 28

def in_context(context)
  @context = context
  self
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)

33
34
35
36
# File 'lib/shoulda/action_controller/matchers/redirect_to_matcher.rb', line 33

def matches?(controller)
  @controller = controller
  redirects_to_url?
end