<!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">
Hi, <br>
<br>
I think @header may not be an implementation detail in this case.<br>
<br>
If your layout looks like this:<br>
<br>
...<br>
&lt;head&gt;<br>
&lt;title&gt;&lt;%= @header || 'Default Title' %&gt;&lt;/title&gt;<br>
&lt;/head&gt;<br>
...<br>
<br>
And the view we are testing looks like this:<br>
<br>
...<br>
&lt;h1&gt;&lt;%= @header = 'Specific Title'&gt;&lt;/h1&gt;<br>
...<br>
<br>
Then setting @header is an essential behavior for the view spec.<br>
<br>
Or am I missing something?<br>
<br>
Cheers!<br>
Patrick<br>
<blockquote
 cite="mid8d961d900706300052n47b6798ci16a2d0b5667ccd42@mail.gmail.com"
 type="cite">
  <pre wrap="">@header is an implementation detail of your view that you shouldn't
care about in your view spec at all. I recommend you use the have_tag
matcher instead to verify what content gets rendered as expected.

Aslak

On 6/29/07, Jeremy Stephens <a class="moz-txt-link-rfc2396E" href="mailto:jeremy.f.stephens@vanderbilt.edu">&lt;jeremy.f.stephens@vanderbilt.edu&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi all,

In my view specs (for Rails), how can I get at instance variables that
are set within my view?  For example, if my view looks like this:

&lt;% @header = "My Header" -%&gt;
&lt;div&gt;some content&lt;/div&gt;

How can I get to @header from within my view spec?  I've tried @header
and assigns[:header] to no avail.

TIA,
Jeremy

--
Jeremy Stephens   Computer Systems Analyst I    School of Medicine
                  Department of Biostatistics   Vanderbilt University

_______________________________________________
rspec-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a>
<a class="moz-txt-link-freetext" href="http://rubyforge.org/mailman/listinfo/rspec-users">http://rubyforge.org/mailman/listinfo/rspec-users</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->_______________________________________________
rspec-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a>
<a class="moz-txt-link-freetext" href="http://rubyforge.org/mailman/listinfo/rspec-users">http://rubyforge.org/mailman/listinfo/rspec-users</a>

  </pre>
</blockquote>
<br>
</body>
</html>