Sha256: 06b13eb2601fe2bbe25fda2425a794ec89a47c9bd6f7de30d01fc3252a2e39ac
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
module BehaviorRenderTestHelper def assert_renders(expected, input, url = nil) output = get_render_output(input, url) message = "<#{expected.inspect}> expected but was <#{output.inspect}>" assert_block(message) { expected == output } end def assert_render_match(regexp, input, url = nil) output = get_render_output(input, url) message = "<#{output.inspect}> expected to be =~ <#{regexp.inspect}>" assert_block(message) { output =~ regexp } end def assert_headers(expected_headers, url = nil) setup_behavior(url) headers = @behavior.page_headers message = "<#{expected_headers.inspect}> expected but was <#{headers.inspect}>" assert_block(message) { expected_headers == headers } end private def get_render_output(input, url) setup_behavior(url) @behavior.render_text(input) end def setup_behavior(url) @behavior = @page.behavior @behavior.request = ActionController::TestRequest.new @behavior.request.request_uri = 'http://testhost.tld' + (url || @page.url) @behavior.response = ActionController::TestResponse.new end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.5.0 | test/helpers/behavior_render_test_helper.rb |
radiant-0.5.1 | test/helpers/behavior_render_test_helper.rb |
radiant-0.5.2 | test/helpers/behavior_render_test_helper.rb |