test/helpers/render_test_helper.rb in radiant-0.6.3 vs test/helpers/render_test_helper.rb in radiant-0.6.4
- old
+ new
@@ -1,8 +1,9 @@
module RenderTestHelper
- def assert_renders(expected, input, url = nil)
- output = get_render_output(input, url)
+
+ def assert_renders(expected, input, url = nil, host = nil)
+ output = get_render_output(input, url, host)
message = "<#{expected.inspect}> expected but was <#{output.inspect}>"
assert_block(message) { expected == output }
end
def assert_render_match(regexp, input, url = nil)
@@ -42,16 +43,18 @@
assert_block(message) { expected == output }
end
private
- def get_render_output(input, url)
- setup_page(url)
- @page.render_text(input)
+ def get_render_output(input, url, host = nil)
+ setup_page(url, host)
+ @page.send(:parse, input)
end
-
- def setup_page(url = nil)
+
+ def setup_page(url = nil, host = nil)
@page.request = ActionController::TestRequest.new
@page.request.request_uri = 'http://testhost.tld' + (url || @page.url)
+ @page.request.host = host unless host.nil?
@page.response = ActionController::TestResponse.new
end
-end
\ No newline at end of file
+
+end