# Reload data inside a test?

**URL:** <https://www.ruby-forum.com/t/reload-data-inside-a-test/177175>\
**Category:** Rails\
**Created:** [October 12, 2009, 9:09pm UTC](https://www.ruby-forum.com/t/reload-data-inside-a-test/177175 "2009-10-12T21:09:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [October 12, 2009, 9:09pm UTC](https://www.ruby-forum.com/t/reload-data-inside-a-test/177175/1 "2009-10-12T21:09:20Z")

</div>

Hi,

I something like:

def test\_something  
@object = Object.create(…)  
@object.update\_attribute(…)  
assert\_equal “changed”, @object.attribute  
end

The problem is that in the assertion, @object still holds the old  
values. Isn’t there a reload! method to reload the @object values?

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [October 12, 2009, 9:12pm UTC](https://www.ruby-forum.com/t/reload-data-inside-a-test/177175/2 "2009-10-12T21:12:39Z")

</div>

I found out just after posting. FYI: @object.reload
