Methods
- A
- S
- T
-
- test_capture_captures_the_temporary_output_buffer_in_its_block,
- test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank,
- test_capture_doesnt_escape_twice,
- test_capture_escapes_html,
- test_capture_returns_nil_if_the_returned_value_is_not_a_string,
- test_capture_used_for_read,
- test_content_for_question_mark,
- test_content_for_returns_nil_when_content_missing,
- test_content_for_returns_nil_when_writing,
- test_content_for_should_be_html_safe_after_flush_empty,
- test_content_for_with_block,
- test_content_for_with_block_and_multiple_calls_with_flush,
- test_content_for_with_block_and_multiple_calls_with_flush_nil_content,
- test_content_for_with_block_and_multiple_calls_without_flush,
- test_content_for_with_multiple_calls,
- test_content_for_with_multiple_calls_and_flush,
- test_content_for_with_whitespace_block,
- test_content_for_with_whitespace_block_and_flush,
- test_provide,
- test_with_output_buffer_does_not_assume_there_is_an_output_buffer,
- test_with_output_buffer_restores_the_output_buffer,
- test_with_output_buffer_sets_proper_encoding,
- test_with_output_buffer_swaps_the_output_buffer_given_no_argument,
- test_with_output_buffer_swaps_the_output_buffer_with_an_argument
- V
Instance Public methods
alt_encoding(output_buffer)
Link
setup()
Link
test_capture_captures_the_temporary_output_buffer_in_its_block()
Link
# File actionview/test/template/capture_helper_test.rb, line 10 def test_capture_captures_the_temporary_output_buffer_in_its_block assert_nil @av.output_buffer string = @av.capture do @av.output_buffer << 'foo' @av.output_buffer << 'bar' end assert_nil @av.output_buffer assert_equal 'foobar', string end
test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank()
Link
test_capture_doesnt_escape_twice()
Link
test_capture_escapes_html()
Link
test_capture_returns_nil_if_the_returned_value_is_not_a_string()
Link
test_capture_used_for_read()
Link
test_content_for_question_mark()
Link
test_content_for_returns_nil_when_content_missing()
Link
test_content_for_returns_nil_when_writing()
Link
# File actionview/test/template/capture_helper_test.rb, line 128 def test_content_for_returns_nil_when_writing assert ! content_for?(:title) assert_equal nil, content_for(:title, 'foo') assert_equal nil, content_for(:title) { output_buffer << 'bar'; nil } assert_equal nil, content_for(:title) { output_buffer << " \n "; nil } assert_equal 'foobar', content_for(:title) assert_equal nil, content_for(:title, 'foo', flush: true) assert_equal nil, content_for(:title, flush: true) { output_buffer << 'bar'; nil } assert_equal nil, content_for(:title, flush: true) { output_buffer << " \n "; nil } assert_equal 'bar', content_for(:title) end
test_content_for_should_be_html_safe_after_flush_empty()
Link
# File actionview/test/template/capture_helper_test.rb, line 151 def test_content_for_should_be_html_safe_after_flush_empty assert ! content_for?(:title) content_for :title do content_tag(:p, 'title') end assert content_for(:title).html_safe? content_for :title, "", flush: true content_for(:title) do content_tag(:p, 'title') end assert content_for(:title).html_safe? end
test_content_for_with_block()
Link
test_content_for_with_block_and_multiple_calls_with_flush()
Link
# File actionview/test/template/capture_helper_test.rb, line 73 def test_content_for_with_block_and_multiple_calls_with_flush assert ! content_for?(:title) content_for :title do 'foo' end content_for :title, flush: true do 'bar' end assert_equal 'bar', content_for(:title) end
test_content_for_with_block_and_multiple_calls_with_flush_nil_content()
Link
# File actionview/test/template/capture_helper_test.rb, line 84 def test_content_for_with_block_and_multiple_calls_with_flush_nil_content assert ! content_for?(:title) content_for :title do 'foo' end content_for :title, nil, flush: true do 'bar' end assert_equal 'bar', content_for(:title) end
test_content_for_with_block_and_multiple_calls_without_flush()
Link
# File actionview/test/template/capture_helper_test.rb, line 95 def test_content_for_with_block_and_multiple_calls_without_flush assert ! content_for?(:title) content_for :title do 'foo' end content_for :title, flush: false do 'bar' end assert_equal 'foobar', content_for(:title) end
test_content_for_with_multiple_calls()
Link
test_content_for_with_multiple_calls_and_flush()
Link
test_content_for_with_whitespace_block()
Link
# File actionview/test/template/capture_helper_test.rb, line 106 def test_content_for_with_whitespace_block assert ! content_for?(:title) content_for :title, 'foo' content_for :title do output_buffer << " \n " nil end content_for :title, 'bar' assert_equal 'foobar', content_for(:title) end
test_content_for_with_whitespace_block_and_flush()
Link
# File actionview/test/template/capture_helper_test.rb, line 117 def test_content_for_with_whitespace_block_and_flush assert ! content_for?(:title) content_for :title, 'foo' content_for :title, flush: true do output_buffer << " \n " nil end content_for :title, 'bar', flush: true assert_equal 'bar', content_for(:title) end
test_provide()
Link
# File actionview/test/template/capture_helper_test.rb, line 164 def test_provide assert !content_for?(:title) provide :title, "hi" assert content_for?(:title) assert_equal "hi", content_for(:title) provide :title, "<p>title</p>" assert_equal "hi<p>title</p>", content_for(:title) @view_flow = ActionView::OutputFlow.new provide :title, "hi" provide :title, "<p>title</p>".html_safe assert_equal "hi<p>title</p>", content_for(:title) end
test_with_output_buffer_does_not_assume_there_is_an_output_buffer()
Link
test_with_output_buffer_restores_the_output_buffer()
Link
# File actionview/test/template/capture_helper_test.rb, line 197 def test_with_output_buffer_restores_the_output_buffer buffer = ActionView::OutputBuffer.new @av.output_buffer = buffer @av.with_output_buffer do @av.output_buffer << '.' end assert buffer.equal?(@av.output_buffer) end
test_with_output_buffer_sets_proper_encoding()
Link
# File actionview/test/template/capture_helper_test.rb, line 206 def test_with_output_buffer_sets_proper_encoding @av.output_buffer = ActionView::OutputBuffer.new # Ensure we set the output buffer to an encoding different than the default one. alt_encoding = alt_encoding(@av.output_buffer) @av.output_buffer.force_encoding(alt_encoding) @av.with_output_buffer do assert_equal alt_encoding, @av.output_buffer.encoding end end
test_with_output_buffer_swaps_the_output_buffer_given_no_argument()
Link
# File actionview/test/template/capture_helper_test.rb, line 178 def test_with_output_buffer_swaps_the_output_buffer_given_no_argument assert_nil @av.output_buffer buffer = @av.with_output_buffer do @av.output_buffer << '.' end assert_equal '.', buffer assert_nil @av.output_buffer end
test_with_output_buffer_swaps_the_output_buffer_with_an_argument()
Link
# File actionview/test/template/capture_helper_test.rb, line 187 def test_with_output_buffer_swaps_the_output_buffer_with_an_argument assert_nil @av.output_buffer buffer = ActionView::OutputBuffer.new('.') @av.with_output_buffer(buffer) do @av.output_buffer << '.' end assert_equal '..', buffer assert_nil @av.output_buffer end