Permalink
Browse files

Ported to latest protest

  • Loading branch information...
gus committed Jul 5, 2009
1 parent 181983d commit 495b7bbcbcf3a9124dccb335874c137ed600a80a
Showing with 8 additions and 8 deletions.
  1. +1 −1 Rakefile
  2. +7 −7 lib/chicago/protest/macros.rb
View
@@ -15,7 +15,7 @@ task :test => [:set_test_env, :environment] do
require 'protest'
$:.concat ['./lib', './test']
Dir.glob("./test/*_test.rb").each { |test| require test }
- Protest.run
+ Protest.report
end
desc "Open an irb session preloaded with this library"
@@ -4,29 +4,29 @@ module Chicago
module Protest
module Macros
def asserts_response_status(expected)
- asserts("response status is #{expected}").equals(expected) { last_response.status }
+ asserts("response status is #{expected}") { last_response.status }.equals(expected)
end
def asserts_content_type(expected)
- asserts("content type is #{expected}").equals(expected) { last_response.headers['Content-type'] }
+ asserts("content type is #{expected}") { last_response.headers['Content-type'] }.equals(expected)
end
def asserts_response_body(expected)
- asserts("response body matches #{expected.inspect}").matches(expected) { last_response.body }
+ asserts("response body matches #{expected.inspect}") { last_response.body }.matches(expected)
end
def asserts_location(expected_path)
- asserts("location matches #{expected_path}").matches(expected_path) do
+ asserts("location matches #{expected_path}") do
last_response.headers["Location"]
- end
+ end.matches(expected_path)
end
def asserts_json_response(json, &block)
asserts_content_type 'application/json'
- asserts("response body has JSON").equals(last_response.body) do
+ asserts("response body has JSON") do
json = json.to_json unless json.instance_of?(String)
json
- end
+ end.equals(last_response.body)
end
# Usage:

0 comments on commit 495b7bb

Please sign in to comment.