From 430068458d11337b64b8ca6437defabbf6f4e18b Mon Sep 17 00:00:00 2001 From: Skud Date: Thu, 14 Feb 2013 11:53:01 +1100 Subject: [PATCH] tests for markdown --- app/views/forums/show.html.haml | 3 ++- spec/views/forums/index.html.haml_spec.rb | 4 ++++ spec/views/forums/show.html.haml_spec.rb | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/forums/show.html.haml b/app/views/forums/show.html.haml index 6cd636e19..681588352 100644 --- a/app/views/forums/show.html.haml +++ b/app/views/forums/show.html.haml @@ -3,7 +3,8 @@ %p#notice= notice %p - = @forum.description + :markdown + #{ strip_tags(@forum.description) } %p This forum is run by = link_to @forum.owner, @forum.owner diff --git a/spec/views/forums/index.html.haml_spec.rb b/spec/views/forums/index.html.haml_spec.rb index 273fad99f..266033693 100644 --- a/spec/views/forums/index.html.haml_spec.rb +++ b/spec/views/forums/index.html.haml_spec.rb @@ -10,4 +10,8 @@ describe "forums/index" do it "renders a list of forums" do assert_select "h2", :text => @forum1.name, :count => 2 end + + it "parses markdown description into html" do + assert_select "em", "Everything" + end end diff --git a/spec/views/forums/show.html.haml_spec.rb b/spec/views/forums/show.html.haml_spec.rb index c5b62f69b..0861753be 100644 --- a/spec/views/forums/show.html.haml_spec.rb +++ b/spec/views/forums/show.html.haml_spec.rb @@ -7,10 +7,14 @@ describe "forums/show" do end it "renders attributes" do - rendered.should contain @forum.description + rendered.should contain "Everything about permaculture" rendered.should contain @forum.owner.to_s end + it "parses markdown description into html" do + assert_select "em", "Everything" + end + it 'links to new post with the forum id' do assert_select "a[href=#{new_post_path(:forum_id => @forum.id)}]" end