similar to: Functional Test Problem. Nubee, please help

Displaying 20 results from an estimated 2000 matches similar to: "Functional Test Problem. Nubee, please help"

2005 Dec 29
1
Posting to a separate controller in a functional test
Hi, I need to post to a controller to log in a user in a functional test, but I''m not sure what to do to post to a separate controller. I''ve tried: post { :controller => :account, :action => :do_login }, { bla bla bla } But that doesnt seem to have worked. Help? Mitch -- Posted via http://www.ruby-forum.com/.
2006 Feb 03
2
testing to see if emails are sent out on exceptions
Hi, I''m using ActionController::rescue_action_in_public() to send emails when uncaught exceptions happen. Is it possible to write tests for that? Joe
2006 Apr 18
7
Functional test, pls help!!!!
Hi guys, recently encountered this funny problem which i really dunno wat happen... I have been trying on it for the past few days and just doesnt work.Hope you guys can give me some enlightenment. Problem: The functional test doesnt seems to be able to recognise one of my model, and when i run the test, it keeps giving me the error of"You have nil object when you don''t expect
2006 Jul 02
5
"the number of parameters does not match the number of substitutions" error
All of a sudden, I''m getting this error: 1) Error: test_index(AccountControllerTest): RuntimeError: The number of parameters does not match the number of substitutions. /home/joe/projects/tanga/trunk/config/../vendor/rails/actionpack/lib/action_controller/assertions.rb:92:in `assert_redirected_to''
2006 Aug 02
1
REST and functional tests
Just playing around with converting an apps to the new REST goodness in edge rails, and I''m trying to work out how to convert/write the functional tests. Is the recommended way to explicitly use the actions (e.g. get :show, :id => ...; post :create,..., etc) and test the routes separately, or duplicate the request, in which case how is that done get "/", :id => 5
2005 Mar 09
9
Unit testing + instance variables
After *much* digging and playing around, I finally figured out how to unit test instance variables that are created by actions. It was more difficult than I expected. It seems like there should have been a more straight forward way to do this. Can someone enlighten me? A simplified and somewhat contrived example of what I am current doing: Thanks. Matt >> # My Controller of interest
2006 Jun 06
14
How can I set the session in a functional test?
Hey :) I need to simulate a login in my functional test, otherwise I can''t GET nor POST to the action. I need to set the session key "logged_in_user_id". I tried this inside the setup() method: session[''logged_in_user_id''] = 1 But that throws: TypeError: can''t convert String into Integer Any ideas? Thanks, Rob -------------- next part
2006 Oct 12
2
Test should fail !
Hello, a very strange thing is happening : the test below pass but it should fail I had a syntax error which produced an exception in the browser and http 500 in the script/console (using app.get ''/'') But with rake test:functionals it passes - How is it possible ? Of course this file is really executed by the test suite, I can see it in the screen output of rake Which
2008 Jan 21
9
DRY act_as_authenticated functional testing
I''m using the acts_as_authenticated plug-in for my app. Now I need to get my functional tests to work properly. I have not written functional tests before so I''m unsure how to utilize setup so that all of my tests can use the login. My tests pass if I put login_as :user inside of each test, but that''s clearly not DRY. Can I add something to my test_helper.rb file or
2006 Jun 27
4
Action Mailer - weird rendering issues
Hello, While sending email notifications from ThoughtNotifier, I am getting weird exceptions, which sometimes occur on the production machine, but I haven''t been able to reproduce on my development machine. There should be no error while rendering `thought_notifier/share_notification.rhtml'' template, but if for some reason it is rendering
2006 Aug 11
1
Calling a Controller method from the command line
Hi All, I need to run some reports via cron. I know I can use runner and call a method in a model class. But I''d really like to use templates and IMO this kind of logic belongs in a controller anyways. These are periodic reports so I don''t need nor want to leave a server running all the time, so getting the data via curl/wget isn''t really an option. What I really
2006 Apr 28
2
tests and login_engine
Hi there, I just started writing tests today after some months of using rails (slap wrists). I seem to be getting the hang of things, but I''m hitting a wall when it comes to functional_testing pages protected by login_engine/user_engine. all my assertions come back with: Expected response to be a <:success>, but was <302> Is there a way I can login from within a test?
2007 Aug 17
1
Testing webservices in Integration Tests with Jamis Buck's recipe?
Hello, I''m using Jamis Buck''s recipe to do integration tests on an application, but I got a nil.recycle! error while doing a webservice call. This is the situation. def test_uploading_data invoke :upload, data invoke :upload, even_more_data real_user_session = new_session_as @real_user real_user_session.press_magic_button_to_enable_more_uploads invoke :upload,
2009 Apr 06
9
setup method in functional tests and instance variables
I have the following in my functional test file. class UserControllerTest < ActionController::TestCase fixtures :users def setup @controller = UserController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @invalid_user = user(:invalid_user) @valid_user = users(:valid_user) end def test_login_success
2006 Jul 06
6
Problem with gettext and functional tests
Hi, I am using gettext to let my web application know several languages. All works fine, but since I integrated it, my functional tests don''t work any more. I keep getting the error message: NoMethodError: undefined method `cgi'' for #<ActionController::TestRequest:0xb77f7f88>. All right, TestRequest doesn''t have a cgi method. Therefore I just included this into
2007 Dec 06
10
Feedback on RC2
I tried to upgrade my existing application to RC2 last night. Like many, I use this mostly for running scheduled tasks. For the moment, I''ve abandoned the effort, but am looking forward to being able to use this. Feedback below: First, the reason I was looking forward to this upgrade was to use the threaded scheduler. I have an application with long-running tasks. I found that
2005 Nov 19
1
How I provide a session object to Functional Tests?
People, I''m looking at p. 152 in the Rails book where he talks about testing controllers [ functional tests ]. First he shows a method, test_login_with_valid_user, which tests that it''s possible to login with a valid user/password combo. Then, he talks about extracting the code he just wrote and placing it into a login method inside of test_helper.rb Once the method is there,
2006 Mar 27
2
Form Validation with 2 models on form. Nubee Question
I have one form in which i enter Person data and Employee Data. A Person and Employee model are used. I am using a legacy schema, so this is forced. How do i use save the data while using rails form validation?? I only want both models to save if they both save. Controller : This odviously doesnt work: def create_employee_and_person employee = Employee.new(params[:employee]) person =
2006 May 03
1
Nubee Fixtures + Tests problem
According to the book, @timesheets["first_timesheet"] should be accesible from within my functional test, but its not! Timesheets.yml : first_timesheet: status: 2 start_date: 2006-04-24 cost: 10 employee: 444 id: 10683 charge: 20 My Test : class AdminTimesheetsControllerTest < Test::Unit::TestCase fixtures :timesheets def test_viewTimesheet get
2006 May 09
3
"ActiveRecord::Base.connection.execute" nubee problem
Is there any way of executing a full sql script, and not just one statement? You can do this: ActiveRecord::Base.connection.execute("insert into batches (name) values ''name''") but not this: ActiveRecord::Base.connection.execute("insert into batches (name) values ''name''; "insert into batches (name) values