diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-16 14:28:39 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-16 14:54:22 -0300 |
commit | 9290fc5ce213836f666a97e0e458d98e69a920ac (patch) | |
tree | 613d7a4918cd94311aaae0cecf82d48c217c7c51 /actionview/test | |
parent | 9830ebbeaf6f7faead9b4503ed9c9ab0a327df9a (diff) | |
download | rails-9290fc5ce213836f666a97e0e458d98e69a920ac.tar.gz rails-9290fc5ce213836f666a97e0e458d98e69a920ac.tar.bz2 rails-9290fc5ce213836f666a97e0e458d98e69a920ac.zip |
Build only one PartialIteration object for loop
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/partial_iteration_test.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/actionview/test/template/partial_iteration_test.rb b/actionview/test/template/partial_iteration_test.rb index af0dde96c3..695f9f1bef 100644 --- a/actionview/test/template/partial_iteration_test.rb +++ b/actionview/test/template/partial_iteration_test.rb @@ -3,28 +3,31 @@ require 'action_view/renderer/partial_renderer' class PartialIterationTest < ActiveSupport::TestCase def test_has_size_and_index - iteration = ActionView::PartialIteration.new 3, 0 + iteration = ActionView::PartialIteration.new 3 assert_equal 0, iteration.index, "should be at the first index" assert_equal 3, iteration.size, "should have the size" end def test_first_is_true_when_current_is_at_the_first_index - iteration = ActionView::PartialIteration.new 3, 0 + iteration = ActionView::PartialIteration.new 3 assert iteration.first?, "first when current is 0" end def test_first_is_false_unless_current_is_at_the_first_index - iteration = ActionView::PartialIteration.new 3, 1 + iteration = ActionView::PartialIteration.new 3 + iteration.iterate! assert !iteration.first?, "not first when current is 1" end def test_last_is_true_when_current_is_at_the_last_index - iteration = ActionView::PartialIteration.new 3, 2 + iteration = ActionView::PartialIteration.new 3 + iteration.iterate! + iteration.iterate! assert iteration.last?, "last when current is 2" end def test_last_is_false_unless_current_is_at_the_last_index - iteration = ActionView::PartialIteration.new 3, 0 + iteration = ActionView::PartialIteration.new 3 assert !iteration.last?, "not last when current is 0" end end |