# Dependency between tests using partials and locals

**URL:** <https://www.ruby-forum.com/t/dependency-between-tests-using-partials-and-locals/129234>\
**Category:** Rails\
**Created:** [February 15, 2008, 5:21pm UTC](https://www.ruby-forum.com/t/dependency-between-tests-using-partials-and-locals/129234 "2008-02-15T17:21:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [February 15, 2008, 5:21pm UTC](https://www.ruby-forum.com/t/dependency-between-tests-using-partials-and-locals/129234/1 "2008-02-15T17:21:26Z")

</div>

Hi all!

I have a couple of tests that should fail, but don’t. They involve  
rendering of templates using partials with locals.

If I run one test alone, it fails because I have forgotten to pass the  
locals in that test.

If I run the same test just after another test that renders the same  
partial passing locals correctly, both tests succeed!

I seems the locals passed in the first test are passed to the second  
test, only with nil values.

Is this a known problem? Is there a workaround that only involves  
changing my tests, or do I have to change my templates?

All replies are appreciated, and feel free to direct me to relevant  
documentation.

Uwe

---

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [February 15, 2008, 6:06pm UTC](https://www.ruby-forum.com/t/dependency-between-tests-using-partials-and-locals/129234/2 "2008-02-15T18:06:12Z")

</div>

I’m not aware of such a problem, so I can’t point you anywhere else. I’d  
like to see some tests and code that demonstrate the problem, though;  
I’m  
intrigued.

Craig

---

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [February 15, 2008, 7:35pm UTC](https://www.ruby-forum.com/t/dependency-between-tests-using-partials-and-locals/129234/3 "2008-02-15T19:35:43Z")

</div>

I attach an example application that does not run, but you can run the  
tests. Both test cases “wet” and “dry” should fail, and the “wet” test  
case fails if run alone, but not together with the “dry” test case.

Give it a try, and let me know your results.

Uwe
