Class ActiveMatchers::Matchers::ResponseMatchers::SuccessMatcher
In: lib/matchers/response_matchers.rb
Parent: Object

Methods

Public Class methods

[Source]

   # File lib/matchers/response_matchers.rb, line 5
5:         def initialize(controller)
6:           @controller = controller
7:         end

Public Instance methods

[Source]

    # File lib/matchers/response_matchers.rb, line 23
23:         def failure_message
24:           if @template.nil? || !@response.success?
25:             "Response should have succeeded, but returned with code #{@response.response_code}."
26:           else
27:             "Response should have rendered #{@template}, but instead rendered #{@response.rendered_file}."
28:           end
29:         end

[Source]

    # File lib/matchers/response_matchers.rb, line 9
 9:         def matches?(response)
10:           @response = response
11:           if @template.nil?
12:             @response.success?
13:           else
14:             @response.success? && full_path(@template) == full_path(@response.rendered_file)
15:           end
16:         end

[Source]

    # File lib/matchers/response_matchers.rb, line 31
31:         def negative_failure_message
32:           if @response.success?
33:             "Response should not have succeeded, but did."
34:           else
35:             "Response should not have rendered #{@template}, but did."
36:           end
37:         end

[Source]

    # File lib/matchers/response_matchers.rb, line 18
18:         def with_template(template)
19:           @template = template
20:           self
21:         end

[Validate]