From 47996ea1d37d3d28edda6396bf68a6952b1fb749 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Fri, 5 Aug 2011 09:06:44 -0500 Subject: [PATCH] Fix tests for above. Set does not have a 'last' method. --- test/test_helper.rb | 8 +++++--- test/unit/chunks/wiki_test.rb | 11 ++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 77be2e46..6a8d18c8 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -100,10 +100,12 @@ module ChunkMatch # Test if requested parts are correct. expected_chunk_state.each_pair do |a_method, expected_value| - assert content.chunks.last.kind_of?(chunk_type) - assert_respond_to(content.chunks.last, a_method) - assert_equal(expected_value, content.chunks.last.send(a_method.to_sym), + content.chunks.each do |c| + assert c.kind_of?(chunk_type) + assert_respond_to(c, a_method) + assert_equal(expected_value, c.send(a_method.to_sym), "Wrong #{a_method} value") + end end end diff --git a/test/unit/chunks/wiki_test.rb b/test/unit/chunks/wiki_test.rb index 601d2215..988ebb6c 100755 --- a/test/unit/chunks/wiki_test.rb +++ b/test/unit/chunks/wiki_test.rb @@ -130,11 +130,12 @@ class WikiTest < Test::Unit::TestCase def assert_link_parsed_as(expected_page_name, expected_link_text, expected_link_type, link) link_to_file = ContentStub.new(link) WikiChunk::Link.apply_to(link_to_file) - chunk = link_to_file.chunks.last - assert chunk - assert_equal expected_page_name, chunk.page_name - assert_equal expected_link_text, chunk.link_text - assert_equal expected_link_type, chunk.link_type + link_to_file.chunks.each do |chunk| + assert chunk + assert_equal expected_page_name, chunk.page_name + assert_equal expected_link_text, chunk.link_text + assert_equal expected_link_type, chunk.link_type + end end end