-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparagraph_marker_test.rb
54 lines (45 loc) · 2.09 KB
/
paragraph_marker_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
gem 'simplecov', :require => false, :group => :test
require 'simplecov'
SimpleCov.start
gem 'minitest'
require 'minitest/autorun'
require 'minitest/pride'
require './paragraph_marker'
class ParagraphMarkerTest < Minitest::Test
def test_blank_strand
#changed to a blank array since joiner and splitter were
#removed from paragraph and header classes
pm = ParagraphMarker.new
assert_equal [], pm.mark_paragraphs("")
end
def test_that_lines_are_separated_on_chunk
pm = ParagraphMarker.new
assert_equal ["Does", "This", "Separate"], pm.paragraph_splitter("Does\n\nThis\n\nSeparate")
end
def test_that_string_doesnt_start_separate_on_one_line_end
pm = ParagraphMarker.new
assert_equal ["This\nstring\nshouldn't\nseparate"], pm.paragraph_splitter("This\nstring\nshouldn't\nseparate")
end
def test_for_not_adding_tags_at_line_beginning_in_a_hash
pm = ParagraphMarker.new
assert_equal ["#These", "#shouldn't", "#get", "#tagged"], pm.tag_adder(["#These", "#shouldn't", "#get", "#tagged"])
end
def test_for_adding_tags_at_line_beggining_without_hashes
pm = ParagraphMarker.new
assert_equal ["<p>These</p>", "<p>should</p>", "<p>get</p>", "<p>tagged</p>"], pm.tag_adder(["These", "should", "get", "tagged"])
end
def test_mixed_text_for_tags_and_no_tags
pm = ParagraphMarker.new
assert_equal ["#Some", "<p>of\nThese</p>", "#should", "<p>get</p>", "#tagged"], pm.tag_adder(["#Some", "of\nThese", "#should", "get", "#tagged"])
end
# def test_that_short_array_is_joined_with_proper_paragraph_spacing
# skip #removed joiner piece, just passing along the array to the next class
# pm = ParagraphMarker.new
# assert_equal "<p>Does</p>\n\n<p>This</p>\n\n<p>Join</p>", pm.line_joiner(["<p>Does</p>", "<p>This</p>", "<p>Join</p>"])
# end
def test_the_whole_process
#changed to return array when i removed splitter and joiner between paragraph and header classes
pm = ParagraphMarker.new
assert_equal ["#Some", "<p>of\nThese</p>", "#should", "<p>get</p>", "#tagged"], pm.mark_paragraphs("#Some\n\nof\nThese\n\n#should\n\nget\n\n#tagged")
end
end