Howdy all
Apologies to the folks subscribed to the globalize list for dual
posting this message...
I've got a project running globalize and rails 1.1.4, and I've only
recently adopted a strong love for testing. Now my models are 100%
tested (I must note that I do not make use of any translations in the
database yet), and I've now started with functional tests before
moving on to integration tests.
It seems I cannot "assert_template" without getting results like:
1. assert_template "index.rhtml" yields:
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
and 2. assert_template "index" yields:
expecting <"index"> but rendering with <"index.rhtml">
I've spent the whole evening googling and digging around mailing list
archives, but to no avail... I know that testing is still on the todo
list for globalize, but what
is everyone else doing at the moment regarding functional tests? Does
the same count for integration tests? Or maybe if someone can point me
in the right direction for fixing the functional tests I can get
started on it.
But, I need to stress how thankfull I am for the code so far, it is
really a marvel.
Best
--
Kenneth Kalmer
kenneth.kalmer@gmail.com
Folding@home stats
http://fah-web.stanford.edu/cgi-bin/main.py?qtype=userpage&username=kenneth%2Ekalmer
--
Kenneth Kalmer
kenneth.kalmer@gmail.com
Folding@home stats
http://fah-web.stanford.edu/cgi-bin/main.py?qtype=userpage&username=kenneth%2Ekalmer
on 17.07.2006 23:05
on 17.07.2006 23:18
On 7/17/06, Kenneth Kalmer <kenneth.kalmer@gmail.com> wrote: > > list for globalize, but what > is everyone else doing at the moment regarding functional tests? Does > the same count for integration tests? Or maybe if someone can point me > in the right direction for fixing the functional tests I can get > started on it. These just look like standard rails failures rather than globalize failures. Try using assert_template 'index' or if it's in a subdir 'admin/index' or whatever. I've never been sure of the exact syntax but it's usually 'layout_name/view_name' without any .rhtml or .rxml on the end. When you render just a layout you usually have 'layouts/layout_name' so it's somehow tied to the filesystem but I'm not entirely sure how yet. I'm pleased that there are other people out there that love testing as much as I do. Have you found rcov? Green bars are my opiate of choice. Cheers, Chuck Vose
on 17.07.2006 23:34
On 7/17/06, Chuck Vose <vosechu@create-on.com> wrote: > > moving on to integration tests. > > archives, but to no avail... I know that testing is still on the todo > on the end. When you render just a layout you usually have > 'layouts/layout_name' so it's somehow tied to the filesystem but I'm > not entirely sure how yet. > > I'm pleased that there are other people out there that love testing as > much as I do. Have you found rcov? Green bars are my opiate of choice. Thanks, but I'm sure the problems somehow relate to globalize, I just can't put my finger on iit. This one project is the only one making use of globalize at the moment, and all my other projects have over 90% coverage at this point in time (using the same test helper). Below is my helper, accompanied with a functional test and the failure. <test_helper.rb> def get_page(action, template, params = {}, session = {}, flash = {}) # call the action get action, params, session, flash # make sure it is a success assert_response :success # make sure our correct template was rendered assert_template template # check our required variables assert_not_nil assigns(:country) assert_not_nil session[:country] end </test_helper.rb> <welcome_controller_test.rb> def test_welcome # test the homepage get_page "index", 'index' end </welcome_controller_test.rb> <two_different_errors> kenneth@jenny ~/work/wellness $ r test/functional/general/welcome_controller_test.rb Loaded suite test/functional/general/welcome_controller_test Started F Finished in 0.055704 seconds. 1) Failure: test_welcome(General::WelcomeControllerTest) [./test/functional/general/../../test_helper.rb:39:in `get_page' test/functional/general/welcome_controller_test.rb:17:in `test_welcome']: expecting <"index"> but rendering with <"index.rhtml"> 1 tests, 2 assertions, 1 failures, 0 errors kenneth@jenny ~/work/wellness $ r test/functional/general/welcome_controller_test.rb Loaded suite test/functional/general/welcome_controller_test Started E Finished in 0.050716 seconds. 1) Error: test_welcome(General::WelcomeControllerTest): NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occured while evaluating nil.[] ./test/functional/general/../../test_helper.rb:43:in `get_page' test/functional/general/welcome_controller_test.rb:17:in `test_welcome' 1 tests, 3 assertions, 0 failures, 1 errors </two_different_errors> Thanks for the help, any insight would be really appreciated. Best -- Kenneth Kalmer kenneth.kalmer@gmail.com Folding@home stats http://fah-web.stanford.edu/cgi-bin/main.py?qtype=userpage&username=kenneth%2Ekalmer
on 19.07.2006 01:12
On 7/17/06, Kenneth Kalmer <kenneth.kalmer@gmail.com> wrote: > > > database yet), and I've now started with functional tests before > > > I've spent the whole evening googling and digging around mailing list > > but it's usually 'layout_name/view_name' without any .rhtml or .rxml > 90% coverage at this point in time (using the same test helper). Below > # make sure our correct template was rendered > # test the homepage > Finished in 0.055704 seconds. > Loaded suite test/functional/general/welcome_controller_test > test/functional/general/welcome_controller_test.rb:17:in `test_welcome' > > 1 tests, 3 assertions, 0 failures, 1 errors > </two_different_errors> > > Thanks for the help, any insight would be really appreciated. Sorry, I have to admit that I don't know the answer or where to even begin. Usually I have at least something I can say that may help but I'm totally stumped. I hope you get it sorted, seems like a fascinating problem. -Chuck Vose
on 19.07.2006 01:15
On 7/17/06, Kenneth Kalmer <kenneth.kalmer@gmail.com> wrote: > > > database yet), and I've now started with functional tests before > > > I've spent the whole evening googling and digging around mailing list > > but it's usually 'layout_name/view_name' without any .rhtml or .rxml > 90% coverage at this point in time (using the same test helper). Below > # make sure our correct template was rendered > # test the homepage > Finished in 0.055704 seconds. > Loaded suite test/functional/general/welcome_controller_test > test/functional/general/welcome_controller_test.rb:17:in `test_welcome' > > 1 tests, 3 assertions, 0 failures, 1 errors > </two_different_errors> > > Thanks for the help, any insight would be really appreciated. Sorry, I have to admit that I don't know the answer or where to even begin. Usually I have at least something I can say that may help but I'm totally stumped. I hope you get it sorted, seems like a fascinating problem. -Chuck Vose
on 05.06.2007 20:37
Kenneth Kalmer wrote: > On 7/17/06, Chuck Vose <vosechu@create-on.com> wrote: >> > moving on to integration tests. >> > archives, but to no avail... I know that testing is still on the todo >> on the end. When you render just a layout you usually have >> 'layouts/layout_name' so it's somehow tied to the filesystem but I'm >> not entirely sure how yet. >> >> I'm pleased that there are other people out there that love testing as >> much as I do. Have you found rcov? Green bars are my opiate of choice. > > Thanks, but I'm sure the problems somehow relate to globalize, I just > can't put my finger on iit. This one project is the only one making > use of globalize at the moment, and all my other projects have over > 90% coverage at this point in time (using the same test helper). Below > is my helper, accompanied with a functional test and the failure. Hi, I am too having problems with Globalize and assert_redirect, or rather follow_redirect. The code in follow_redirect assumes a fixed "controller/action/id" URL pattern and I changed my URL to "locale/contr/action/id", which makes all "follow_redirect" calls in the functional tests fail. Maybe this is related. I have filed a bug about this in the Rails Trac ... we'll see. Jens