Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

… it does an equals
  • Loading branch information...
commit 7079238a1c24304a9a06664c1dcf346d431d51f2 1 parent c80a3ce
@gus gus authored
View
6 lib/chicago/riot/macros.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)
View
2  test/riot_tests/application_test.rb
@@ -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
View
2  test/riot_tests/helpers_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.