Permalink
Browse files

asserts_response_body does a match only if expected is a Regexp, else…

… it does an equals
  • Loading branch information...
1 parent c80a3ce commit 7079238a1c24304a9a06664c1dcf346d431d51f2 @gus gus committed Dec 21, 2009
Showing with 7 additions and 3 deletions.
  1. +5 −1 lib/chicago/riot/macros.rb
  2. +1 −1 test/riot_tests/application_test.rb
  3. +1 −1 test/riot_tests/helpers_test.rb
@@ -12,7 +12,11 @@ def asserts_content_type(expected)
end
def asserts_response_body(expected)
- asserts("response body matches #{expected.inspect}") { last_response.body }.matches(expected)
+ if (expected.kind_of?(Regexp))
+ asserts("response body matches #{expected.inspect}") { last_response.body }.matches(expected)
+ else
+ asserts("response body is exactly #{expected.inspect}") { last_response.body }.equals(expected)
+ end
end
def asserts_location(expected_path)
@@ -42,7 +42,7 @@
context "getting obvious views" do
setup { get '/baz' }
- asserts_response_body "Whatever man. That's just like, your opinion."
+ asserts_response_body "Whatever man. That's just like, your opinion.\n"
end # getting obvious views
end
@@ -105,7 +105,7 @@
get '/foo'
end
- asserts_response_body %Q[<a href="/bar">foo</a>]
+ asserts_response_body %Q[<a href="/bar">foo</a>\n]
end # for plain old foo
context "with options" do

0 comments on commit 7079238

Please sign in to comment.