Module: ResponseMatchers

Defined in:
lib/responses.rb,
lib/use_layout.rb

Overview

Module for testing the layout used in a response object

Defined Under Namespace

Classes: ResponseLocationMatcher, ResponseStatusMatcher, UseLayout

Instance Method Summary collapse

Instance Method Details

#be_an_errorObject

test for a 500 internal server error



32
33
34
# File 'lib/responses.rb', line 32

def be_an_error
  ResponseStatusMatcher.new "500 Internal Error"
end

#be_not_acceptableObject

test for a 406 response



27
28
29
# File 'lib/responses.rb', line 27

def be_not_acceptable
  ResponseStatusMatcher.new "406 Not Acceptable"
end

#be_not_foundObject

test for a 404 response



16
17
18
# File 'lib/responses.rb', line 16

def be_not_found
  ResponseStatusMatcher.new "404 Not Found"
end

#be_successfully_createdObject

test for a 201 response



6
7
8
# File 'lib/responses.rb', line 6

def be_successfully_created 
  ResponseStatusMatcher.new "201 Created"
end

#be_unauthorisedObject Also known as: be_unauthorized

test for a 401 response



21
22
23
# File 'lib/responses.rb', line 21

def be_unauthorised
  ResponseStatusMatcher.new "401 Unauthorized"
end

#be_unprocessableObject

test for a 422 response



11
12
13
# File 'lib/responses.rb', line 11

def be_unprocessable
  ResponseStatusMatcher.new "422 Unprocessable Entity"
end

#point_to(url) ⇒ Object

test that the location points to a given URI



37
38
39
# File 'lib/responses.rb', line 37

def point_to url
  ResponseLocationMatcher.new url
end

#use_layout(expected) ⇒ Object



26
27
28
# File 'lib/use_layout.rb', line 26

def use_layout(expected)
  UseLayout.new(expected)
end