<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
aslak hellesoy wrote:
<blockquote
cite="mid8d961d900707040054r18c6d604pae2f291b2aec14@mail.gmail.com"
type="cite">
<pre wrap="">On 7/3/07, Patrick Ritchie <a class="moz-txt-link-rfc2396E" href="mailto:pritchie@videotron.ca"><pritchie@videotron.ca></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap=""> Hi,
I think @header may not be an implementation detail in this case.
If your layout looks like this:
...
<head>
<title><%= @header || 'Default Title' %></title>
</head>
...
And the view we are testing looks like this:
...
<h1><%= @header = 'Specific Title'></h1>
...
Then setting @header is an essential behavior for the view spec.
Or am I missing something?
</pre>
</blockquote>
<pre wrap=""><!---->
Before I can answer about how to test this with RSpec, I need to
understand what's going on in the code. Isn't the head part of the
layout evaluated before the body? If that's the case, what's the point
of assigning the @header variable in the view? It wouldn't change the
title anyway</pre>
</blockquote>
The layout is evaluated after the view so the above code is a useful
way to include some piece of data in the head without having to
initialize it in the controller. Very handy for things like head/title
or view specific onload js etc...<br>
<br>
Cheers!<br>
Patrick<br>
</body>
</html>