require 'spec_helper' describe HtmlToTextConverter do it 'strips away
tags and adds a newline to the end of the paragraph' do html = '
This is a one sentence paragraph.
' text = HtmlToTextConverter.new(html).parse text.should == "This is a one sentence paragraph.\n" end it 'returns an empty string when given nil' do text = HtmlToTextConverter.new(nil).parse text.should == '' end it 'strips awaytags and adds a newline to the end of each paragraph' do html = '
Paragraph 1
Paragraph 2
' text = HtmlToTextConverter.new(html).parse text.should == "Paragraph 1\nParagraph 2\n" end it 'strips away spaces in between tags' do html = 'Paragraph 1
Paragraph 2
' text = HtmlToTextConverter.new(html).parse text.should == "Paragraph 1\nParagraph 2\n" end it 'consolidates whitespace' do html = 'I like hot sauce.
' text = HtmlToTextConverter.new(html).parse text.should == "I like hot sauce.\n" end it 'converts nbsp to a regular space' do html = ' hello world ' text = HtmlToTextConverter.new(html).parse text.should == " hello world " end it 'turns