aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/capture_helper_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 18:50:17 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 18:50:17 +0200
commit4b6c68dfb810c836f87587a16353317d1a180805 (patch)
treebebdbb90baa5f07de0688ec255ee18b460053d18 /actionview/test/template/capture_helper_test.rb
parent66a7cfa91045e05f134efc9ac0e226e66161e2e6 (diff)
downloadrails-4b6c68dfb810c836f87587a16353317d1a180805.tar.gz
rails-4b6c68dfb810c836f87587a16353317d1a180805.tar.bz2
rails-4b6c68dfb810c836f87587a16353317d1a180805.zip
applies new string literal convention in actionview/test
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
Diffstat (limited to 'actionview/test/template/capture_helper_test.rb')
-rw-r--r--actionview/test/template/capture_helper_test.rb98
1 files changed, 49 insertions, 49 deletions
diff --git a/actionview/test/template/capture_helper_test.rb b/actionview/test/template/capture_helper_test.rb
index ffaf773c53..84f5b721b0 100644
--- a/actionview/test/template/capture_helper_test.rb
+++ b/actionview/test/template/capture_helper_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit'
+require "abstract_unit"
class CaptureHelperTest < ActionView::TestCase
def setup
@@ -10,18 +10,18 @@ class CaptureHelperTest < ActionView::TestCase
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'
+ @av.output_buffer << "foo"
+ @av.output_buffer << "bar"
end
assert_nil @av.output_buffer
- assert_equal 'foobar', string
+ assert_equal "foobar", string
end
def test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank
- string = @av.capture('foo', 'bar') do |a, b|
+ string = @av.capture("foo", "bar") do |a, b|
a + b
end
- assert_equal 'foobar', string
+ assert_equal "foobar", string
end
def test_capture_returns_nil_if_the_returned_value_is_not_a_string
@@ -29,13 +29,13 @@ class CaptureHelperTest < ActionView::TestCase
end
def test_capture_escapes_html
- string = @av.capture { '<em>bar</em>' }
- assert_equal '&lt;em&gt;bar&lt;/em&gt;', string
+ string = @av.capture { "<em>bar</em>" }
+ assert_equal "&lt;em&gt;bar&lt;/em&gt;", string
end
def test_capture_doesnt_escape_twice
- string = @av.capture { raw('&lt;em&gt;bar&lt;/em&gt;') }
- assert_equal '&lt;em&gt;bar&lt;/em&gt;', string
+ string = @av.capture { raw("&lt;em&gt;bar&lt;/em&gt;") }
+ assert_equal "&lt;em&gt;bar&lt;/em&gt;", string
end
def test_capture_used_for_read
@@ -48,93 +48,93 @@ class CaptureHelperTest < ActionView::TestCase
def test_content_for_with_multiple_calls
assert ! content_for?(:title)
- content_for :title, 'foo'
- content_for :title, 'bar'
- assert_equal 'foobar', content_for(:title)
+ content_for :title, "foo"
+ content_for :title, "bar"
+ assert_equal "foobar", content_for(:title)
end
def test_content_for_with_multiple_calls_and_flush
assert ! content_for?(:title)
- content_for :title, 'foo'
- content_for :title, 'bar', flush: true
- assert_equal 'bar', content_for(:title)
+ content_for :title, "foo"
+ content_for :title, "bar", flush: true
+ assert_equal "bar", content_for(:title)
end
def test_content_for_with_block
assert ! content_for?(:title)
content_for :title do
- output_buffer << 'foo'
- output_buffer << 'bar'
+ output_buffer << "foo"
+ output_buffer << "bar"
nil
end
- assert_equal 'foobar', content_for(:title)
+ assert_equal "foobar", content_for(:title)
end
def test_content_for_with_block_and_multiple_calls_with_flush
assert ! content_for?(:title)
content_for :title do
- 'foo'
+ "foo"
end
content_for :title, flush: true do
- 'bar'
+ "bar"
end
- assert_equal 'bar', content_for(:title)
+ assert_equal "bar", content_for(:title)
end
def test_content_for_with_block_and_multiple_calls_with_flush_nil_content
assert ! content_for?(:title)
content_for :title do
- 'foo'
+ "foo"
end
content_for :title, nil, flush: true do
- 'bar'
+ "bar"
end
- assert_equal 'bar', content_for(:title)
+ assert_equal "bar", content_for(:title)
end
def test_content_for_with_block_and_multiple_calls_without_flush
assert ! content_for?(:title)
content_for :title do
- 'foo'
+ "foo"
end
content_for :title, flush: false do
- 'bar'
+ "bar"
end
- assert_equal 'foobar', content_for(:title)
+ assert_equal "foobar", content_for(:title)
end
def test_content_for_with_whitespace_block
assert ! content_for?(:title)
- content_for :title, 'foo'
+ content_for :title, "foo"
content_for :title do
output_buffer << " \n "
nil
end
- content_for :title, 'bar'
- assert_equal 'foobar', content_for(:title)
+ content_for :title, "bar"
+ assert_equal "foobar", content_for(:title)
end
def test_content_for_with_whitespace_block_and_flush
assert ! content_for?(:title)
- content_for :title, 'foo'
+ 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)
+ content_for :title, "bar", flush: true
+ assert_equal "bar", content_for(:title)
end
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, "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 "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)
+ assert_equal "bar", content_for(:title)
end
def test_content_for_returns_nil_when_content_missing
@@ -143,7 +143,7 @@ class CaptureHelperTest < ActionView::TestCase
def test_content_for_question_mark
assert ! content_for?(:title)
- content_for :title, 'title'
+ content_for :title, "title"
assert content_for?(:title)
assert ! content_for?(:something_else)
end
@@ -151,12 +151,12 @@ class CaptureHelperTest < ActionView::TestCase
def test_content_for_should_be_html_safe_after_flush_empty
assert ! content_for?(:title)
content_for :title do
- content_tag(:p, 'title')
+ content_tag(:p, "title")
end
assert content_for(:title).html_safe?
content_for :title, "", flush: true
content_for(:title) do
- content_tag(:p, 'title')
+ content_tag(:p, "title")
end
assert content_for(:title).html_safe?
end
@@ -178,19 +178,19 @@ class CaptureHelperTest < ActionView::TestCase
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 << '.'
+ @av.output_buffer << "."
end
- assert_equal '.', buffer
+ assert_equal ".", buffer
assert_nil @av.output_buffer
end
def test_with_output_buffer_swaps_the_output_buffer_with_an_argument
assert_nil @av.output_buffer
- buffer = ActionView::OutputBuffer.new('.')
+ buffer = ActionView::OutputBuffer.new(".")
@av.with_output_buffer(buffer) do
- @av.output_buffer << '.'
+ @av.output_buffer << "."
end
- assert_equal '..', buffer
+ assert_equal "..", buffer
assert_nil @av.output_buffer
end
@@ -198,7 +198,7 @@ class CaptureHelperTest < ActionView::TestCase
buffer = ActionView::OutputBuffer.new
@av.output_buffer = buffer
@av.with_output_buffer do
- @av.output_buffer << '.'
+ @av.output_buffer << "."
end
assert buffer.equal?(@av.output_buffer)
end