render markdown in planting descriptions

This commit is contained in:
Skud
2012-12-21 13:45:22 +11:00
parent ccc1dcdc4e
commit 626fc55f37
4 changed files with 14 additions and 4 deletions

View File

@@ -15,7 +15,8 @@
= p.planted_at
%div
= p.description != "" ? p.description : "No description given"
:markdown
#{ p.description != "" ? p.description : "No description given." }
%p
= link_to 'More...', p

View File

@@ -10,7 +10,8 @@
= @planting.quantity != 0 ? @planting.quantity : "not specified"
%p
%b Description:
= @planting.description != "" ? @planting.description : "No description."
:markdown
#{ @planting.description != "" ? @planting.description : "No description." }
- if user_signed_in? && current_user == @planting.owner
= link_to 'Edit', edit_planting_path(@planting), :class => 'btn'

View File

@@ -26,7 +26,7 @@ describe "plantings/index" do
:crop => @crop,
:planted_at => '2008-01-05 12:34:56',
:quantity => 3,
:description => "MyText",
:description => "MyText *ITALIC*",
:created_at => Time.now
),
stub_model(Planting,
@@ -57,4 +57,8 @@ describe "plantings/index" do
rendered.should contain '2008-01-05 12:34:56'
end
it "renders markdown in the description" do
assert_select "em", "ITALIC"
end
end

View File

@@ -21,7 +21,7 @@ describe "plantings/show" do
:garden => @garden,
:crop => @crop,
:quantity => 333,
:description => "MyText"
:description => "MyText *ITALIC*"
))
render
end
@@ -33,4 +33,8 @@ describe "plantings/show" do
it "renders the description" do
rendered.should match(/MyText/)
end
it "renders markdown in the description" do
assert_select "em", "ITALIC"
end
end