On Thu, Oct 15, 2009 at 12:27 PM, Matt Jones <al2o...@gmail.com> wrote:
> On Oct 14, 1:19 pm, Patrick Doyle <wpds...@gmail.com> wrote:
>>
>> The problem is, there is an instance variable in my controller that is
>> set during the handling of the first #add_lot_to_assembly action.  It
>> remains set for the second invocation of #xhr.  This makes me think
>> that the controller instance is not reinstantiated between calls to
>> #xhr.
>>
>> Am I misunderstanding this?
>
> It sounds like you've got a clear idea what's going on.
>
>>
>> Is there some way to reinstantiate the controller prior to the 2nd xhr call?
>>
>> Is there a better way to have structured my functional test?
>>
>> Should I be using something other than a functional test to test this
>> sort of behavior?
>
> The standard way of doing multiple requests in a test is to use an
> integration test. It already takes care of a lot of the stuff you'd
> need to deal with trying to shoehorn this into a functional test.
>
Thanks Matt,
As I was writing my email, I started wondering if I should be using an
integration test instead of a functional test. (Hence my last
question).  My understanding of integration tests is that they are
geared towards testing a flow of operations across multiple
controllers.  I always thought of that as "multiple different
controllers", but obviously there is no reason why that has to be the
case.

I can go fix that.  In the mean time (and just in case anybody
stumbles over this thread in the future), I found that putting:

@controller = LotsController.new

in between my two calls to xhr solved my particular problem.

Do folks generally use the default (implied to mean, "blessed by the
Rails developers") integration tests to test AJAX behavior?  Or do
folks use one of the other test platforms out there?

I come from a background of "I won't really understand why test
platform ABC is better than the default until I have fully appreciated
the limitations of the default test platform."  So I will probably
stay with the standard template for unit, functional, and integration
tests until I run into something that just doesn't work well without
one of the other platforms.

--wpd

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to