Skip to content

Instantly share code, notes, and snippets.

@don-smith
Created October 3, 2010 06:48
Show Gist options
  • Save don-smith/608334 to your computer and use it in GitHub Desktop.
Save don-smith/608334 to your computer and use it in GitHub Desktop.
<html>
<head><title><%= yield(:title) %></title></head>
<body>
<h1><%= yield(:title) %></h1>
<%= yield %>
</body>
</html>
module ApplicationHelper
def title(page_title)
content_for(:title) { page_title }
end
end
require 'spec_helper'
describe ApplicationHelper do
it 'should render page titles' do
page_title = 'Page Title'
helper.should_receive :content_for, :title => page_title
helper.title page_title
end
end
<% title 'Awesome title' %>
<!-- rest of the page -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment