Unit test and get request with a URL

I’m tyring to write a unit test that uses a get() method to simulate a
get request in my functional test. However, get wants an action, and I
have a URL. I’m trying to redirect to a URL the user tried to hit
before logging in. After they login I want to go back to the URL they
originally tried.

I can’t find the get() method code in the help or otherwise. I grepped
through my entire ruby directory and I’ve checked the test_helper, but
it’s not there. Where the heck is it defined? And why isn’t in the
rails API?

Thanks
Charlie

Doesn’t integration testing do what you want ?

http://jamis.jamisbuck.org/articles/2006/03/09/integration-testing-in-rails-1-1

it’s in the api as well:

http://rails.outertrack.com/class/ActionController%3A%3AIntegrationTest

/r/r

On 6/16/06, Charlie [email protected] wrote:

Thanks
Charlie


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Rodney
http://www.pinupgeek.com
http://www.dutchrailers.org

I suppose I could start an integration test instead of my functional
test, but I’m still curious as to where the code is? The functional
test I’m writing doesn’t require that I go across controllers though to
test this. I could write this test as a functional if I could do a get
with a URL. Is there some API that I could call to break URL into a
Hash of :action => “whatever”? Like using the route URL generation code
to break it into a Hash? That way I could use the default get() method.

Thanks
Charlie

Rodney R. wrote:

Doesn’t integration testing do what you want ?

http://jamis.jamisbuck.org/articles/2006/03/09/integration-testing-in-rails-1-1

it’s in the api as well:

http://rails.outertrack.com/class/ActionController%3A%3AIntegrationTest

/r/r

I struggled a bit with this too. The get code seems to be actually
contained in the process code. Check out this entry in the API:
http://api.rubyonrails.org/classes/ActionController/TestProcess.html#M000046

I think the process is implicit in the get call, but like you I found
the apparent lack lack of Api info on the functional tests a it of a
prob.

HTH

Ok I went back and read your post. At first I thought I got it, but
after thinking about it more it didn’t make much sense. So back to
hunting through the rails code to find my answer. The get method’s
aren’t in the docs because they’re generated dynamically on the fly
using this method
(http://api.rubyonrails.org/classes/ActionController/TestProcess.html#M000045)
This might have been what you were trying to tell me, but I guess I
missed it. Thanks Chris T for giving me a more straight forward answer.

That’s how the get, post, etc methods get in your Test::Unit::TestCase.
And you’re right they end up calling process. Very sneaky, and
wonderfully undocumented! Errggg. I’ve wasted two days trying to
understand this, and I don’t think it gets me any closer to my goal.

Charlie

Chris T wrote:

I struggled a bit with this too. The get code seems to be actually
contained in the process code. Check out this entry in the API:
http://api.rubyonrails.org/classes/ActionController/TestProcess.html#M000046

I think the process is implicit in the get call, but like you I found
the apparent lack lack of Api info on the functional tests a it of a
prob.

HTH