lib/hoboken/templates/spec/rack_matchers.rb.tt in hoboken-0.9.0 vs lib/hoboken/templates/spec/rack_matchers.rb.tt in hoboken-0.10.0

- old
+ new

@@ -5,20 +5,22 @@ response.status == response_codes[expected] end failure_message do |response| 'expected last response status to be ' \ - "#{response_codes.fetch(expected, 'unknown')}, " \ - "but was #{response.status}" + "#{response_codes.fetch(expected, 'unknown')}, " \ + "but was #{response.status}" end def response_codes { ok: 200, + no_content: 204, not_authorized: 401, not_found: 404, - redirect: 302 + redirect: 302, + server_error: 500 }.freeze end end RSpec::Matchers.define :have_content_type do |expected| @@ -26,12 +28,12 @@ response.content_type == content_types[expected] end failure_message do |response| 'expected last response to have content type ' \ - "'#{content_types.fetch(expected, 'unknown')}', " \ - "but was '#{response.content_type}'" + "'#{content_types.fetch(expected, 'unknown')}', " \ + "but was '#{response.content_type}'" end def content_types { html: 'text/html;charset=utf-8', @@ -45,10 +47,10 @@ path(response) == expected end failure_message do |response| "expected last response to redirect to '#{expected}', " \ - "but it redirected to '#{path(response)}'" + "but it redirected to '#{path(response)}'" end def path(response) URI(response.location).path end