# Where is #put functional test method documented?

**URL:** <https://www.ruby-forum.com/t/where-is-put-functional-test-method-documented/156679>\
**Category:** Rails\
**Created:** [December 31, 2008, 9:27pm UTC](https://www.ruby-forum.com/t/where-is-put-functional-test-method-documented/156679 "2008-12-31T21:27:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c0e974/32.png) [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Post date:** [December 31, 2008, 9:27pm UTC](https://www.ruby-forum.com/t/where-is-put-functional-test-method-documented/156679/1 "2008-12-31T21:27:25Z")

</div>

I am trying to figure out why the following test case doesn’t work:

def test\_should\_allow\_admin\_to\_become\_non\_admin  
put :update, :id =\> users(:quentin).id, :quentin =\> {:admin =\>  
false}  
assert users(:quentin).admin == false  
assert\_redirected\_to users\_url  
end

For some reason, the "assert users(:quentin).admin == false is failing.  
I  
suppose that there are a couple of reasons for this, the most likely one  
that occurs to me now that I’m writing this down for all to see (and  
laugh  
at) is that “users(:quentin)” is not magically querying the test  
database to  
determine the new value for the “admin” field. Be that as it may, my  
original question still stands…

Where can I find the documentation for the #put method used in  
functional  
tests?

A more general question for the members of the list is this:

How do _you_ read and search the online documentation?

I keep a tab in my browser open to [http://api.rubyonrails.org/](http://api.rubyonrails.org/). When I  
want  
to look at the documentation for “redirect\_to”, pop over to that tab,  
hit  
^F, type in redirect\_to in the find box, and then hit return until I see  
something that looks likely.

There are a couple of problems with this approach.

The first is that [http://api.rubyonrails.org](http://api.rubyonrails.org) displays everything in a  
series  
of 4 frames, and Firefox always starts its search in the upper left  
frame,  
this makes it somewhat difficult as I see something that looks like it  
might  
be what I’m looking for, click on the hyperlink, find out it’s not what  
I’m  
looking for, and have to start back at the beginning of the search.  
Admittedly, this might be a problem with Firefox, but it’s annoying  
nonetheless

The second problem is that searching for something like “put” gets  
ridiculous.

So, I’m curious what other folks do.

–wpd

---

<div class="post-metadata">

**Author:** ![oldbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c0e974/32.png) [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Post date:** [December 31, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/where-is-put-functional-test-method-documented/156679/2 "2008-12-31T21:59:35Z")

</div>

On Wed, Dec 31, 2008 at 3:26 PM, Patrick D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> that occurs to me now that I’m writing this down for all to see (and laugh  
> at) is that “users(:quentin)” is not magically querying the test database to  
> determine the new value for the “admin” field. Be that as it may, my  
> original question still stands…

users(:quentin) is instantiating the user based on your users.yml  
fixture.  
Instead, you’ll want to query the database for the user.

> Where can I find the documentation for the #put method used in functional  
> tests?

It’s in  
ActionController::Integration::Session[http://www.railsbrain.com/api/rails-2.2.2/doc/index.html?a=M000186&name=put#](http://www.railsbrain.com/api/rails-2.2.2/doc/index.html?a=M000186&name=put#)  
.

> So, I’m curious what other folks do.

I use RailsBrain [http://www.railsbrain.com/](http://www.railsbrain.com/) to read the docs for  
Rails. I  
like the interface, and I like that it offers multiple versions of the  
docs.

Regards,  
Craig

---

<div class="post-metadata">

**Author:** ![oldbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c0e974/32.png) [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Post date:** [January 1, 2009, 12:03am UTC](https://www.ruby-forum.com/t/where-is-put-functional-test-method-documented/156679/3 "2009-01-01T00:03:02Z")

</div>

> users(:quentin) is instantiating the user based on your users.yml fixture.  
> Instead, you’ll want to query the database for the user.

Yeah, that dawned on me as I wrote my email. But at that point I still  
wanted to find a better way to search the documentation. RailsBrain  
looks  
like a great find. Thank you for the tip.

–wpd

---

<div class="post-metadata">

**Author:** ![oldbug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c0e974/32.png) [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Post date:** [January 31, 2009, 12:52pm UTC](https://www.ruby-forum.com/t/where-is-put-functional-test-method-documented/156679/4 "2009-01-31T12:52:09Z")

</div>

Even though you figured out what was wrong in the middle of posting,  
thanks for posting it anyways. Google search indexed this post, and  
was one of the first results helping me solve this exact issue.

-Brad
