On 12 Nov 2008, at 00:51, Jesse C. wrote:
rather, I want you to ) be equally comfortable with all three
as expected. How would I go about setting these in the example so they
are available to the partial when it renders?
What you can do is call the template from the example and set up a
stub for each of the locals. So if I have a partial like this:
<%= name %> makes cheese for <%= friend_name %>
Then in the example, you can do this:
describe "when there's a name and a friend name"
In order to keep your view specs from becoming too brittle, I would
strongly suggest that you ‘stub out’ the rendering of the shared
partial in the specs for the two view templates that use the partial.
I usually do this by making a special helper method for rendering the
<%= for relationship in relationships %>
<%= render_relationship(relationship) %>
<% end %>
This makes is easy to stub out the rendering in your main view
Of course you’ll really want a Cucumber test that makes sure the whole
stack fits together (locals are passed through with the correct names)
but I’d suggest that’s a much more flexible solution than tying your
view specs together.