On Wed, Dec 31, 2008 at 3:26 PM, Patrick Doyle <[email protected]> wrote:

> 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...


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#>
.


> 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/.  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 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.


I use RailsBrain <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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to