Skip to content

Commit

Permalink
Add view spec test for pages and h() escape page_title.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncheow committed Nov 15, 2008
1 parent d5c72b0 commit 548218f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/pages/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% content_for(:page_title) do -%>
<%= page_title(@page) -%>
<%=h page_title(@page) -%>
<% end -%>
<%= render :partial => 'pages/page', :locals => {:page => @page} %>
22 changes: 22 additions & 0 deletions spec/views/pages/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require File.dirname(__FILE__) + '/../../spec_helper'

describe "/pages/show.html.erb" do
include UrlHelper

before(:each) do
@page = mock_model(Page,
:title => "A page",
:body_html => "Page content!",
:slug => 'a-page'
)
assigns[:page] = @page
end

after(:each) do
response.should be_valid_xhtml_fragment
end

it "should render a page" do
render "/pages/show.html.erb"
end
end

0 comments on commit 548218f

Please sign in to comment.