# encoding: UTF-8 require 'simplecov' require 'simplecov-rcov' SimpleCov.start SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter require 'test_helper' require 'govspeak_test_helper' class GovspeakTest < Test::Unit::TestCase include GovspeakTestHelper test "simple smoke-test" do rendered = Govspeak::Document.new("*this is markdown*").to_html assert_equal "
this is markdown
\n", rendered end test "simple smoke-test for simplified API" do rendered = Govspeak::Document.to_html("*this is markdown*") assert_equal "this is markdown
\n", rendered end test "simple block extension" do rendered = Govspeak::Document.new("this \n{::reverse}\n*is*\n{:/reverse}\n markdown").to_html assert_equal "this
\n\nsi
\n\nmarkdown
\n", rendered end test "highlight-answer block extension" do rendered = Govspeak::Document.new("this \n{::highlight-answer}Lead in to *BIG TEXT*\n{:/highlight-answer}").to_html assert_equal %Q{this
\n\nLead in to BIG TEXT
\n\n123 Test Street
Testcase Cliffs
Teston
0123 456 7890 \n
I am very informational
The following is very informational
I am very informational
I am very informational
I am very important
The following is very important
I am very important
I am very helpful
The following is very helpful
I am very helpful
I am very helpful
I am very helpful
This is a link isn’t it?
' assert_text_output "This is a link isn’t it?" end test_given_govspeak "This is a [link with an at sign in it](http://www.google.com/@dg/@this) isn't it?" do assert_html_output 'This is a link with an at sign in it isn’t it?
' assert_text_output "This is a link with an at sign in it isn’t it?" end test_given_govspeak " HTML *[HTML]: Hyper Text Markup Language" do assert_html_output %{HTML
} assert_text_output "HTML" end test_given_govspeak "x[a link](http://rubyforge.org)x" do assert_html_output '' assert_text_output "a link" end # Regression test - the surrounded_by helper doesn't require the closing x # so 'xaa' was getting picked up by the external link helper above # TODO: review whether we should require closing symbols for these extensions # need to check all existing content. test_given_govspeak "xaa" do assert_html_output 'xaa
' assert_text_output "xaa" end test_given_govspeak " $! rainbow $!" do assert_html_output %{rainbow
help, send cake
street
road
help
\ncan you tell me how to get to…
zippy
bungle
george
This section applies to Scotland
I am very devolved and very scottish
Message with a link