search for: testrequest

Displaying 20 results from an estimated 49 matches for "testrequest".

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 test_helper.rb: ActionController::TestRequest.send(:include, CGI::QueryExtension). Now the error message changes to: NameError: undefined local variable or method `env_table'' fo...
2007 Apr 06
0
Setting headers in TestRequest
...sts setting the HTTP AUTHORIZATION header. But I can''t find a way to do it in the functional test. I can see the response headers in @response.headers, but there''s no analogous hash in @request. Any hints? Also, I can''t find any API documentation for ActionController::TestRequest -- anybody know where that''s hiding? Thanks! Rod --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3Mb...
2008 Dec 14
0
ActionController::TestRequest bug?
Hi, while starting to setup functional tests for my application I received the following error: NoMethodError: undefined method `server_name'' for #<ActionController::TestRequest which is coming from an instance variable I''m setting up in my application controller. @domain = Domain.find_or_create_by_name(request.server_name) I''m using rails 2.0.2, any guidance would be appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this...
2006 Jan 10
4
Problem creating MockController
...d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller'' # Re-raise errors caught by the controller. #class DiscussionsController; def rescue_action(e) raise e end; end class MockController < ActionController::Base def initialize @url = UrlRewriter.new(ActionController::TestRequest.new, nil) super end end because if I just do require ''action_controller'' I get a no such file error. Problem with this mock is that I get a recursive error: SystemStackError: stack level too deep d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/helpers.rb:...
2006 Mar 27
0
Where is ActionController::TestRequest documentation ?
Hi, I didn''t found any doc about this class - I''m looking for a solution to include a multipart uploaded file in a post request for testing purpose. How can I do ? Thanks -- Posted via http://www.ruby-forum.com/.
2007 Mar 28
3
respond.should be_successful
I''m wondering: Does it make more sense to add on successful? as an alias for success? in ActionController:TestRequest? I keep getting these two mixed up in my specs and was wondering if it would be helpful to anyone as a small patch to rspec. Best, Scott
2007 Jul 02
6
Testing route globbing and limitations of get()
Hi everyone, I''m new to rails and also to rspec, but I tried to do my homework. To answer my questions, I searched this list''s archives, the Rails API, and Google, to no avail. Therefor, I''d be grateful if someone could point me in the right directions: 1) There doesn''t seem to be a counterpart to assert_recognizes in rspec. route_for() won''t work
2006 Apr 27
6
Functional Test Problem. Nubee, please help
...quot;login" controller. How do i login first in a functional test? Im assuming i use the setup method to login the controller. This is the setup method for the Activities controller functional test: def setup @controller = ActivitiesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end my "login" controller has a method "authenticate" which needs params[:username] and params[:password]. Please help! Thanks Allen -- Posted via http://www.ruby-forum.com/.
2006 Jun 16
0
rake spec controller test output hideus.
...tion"=>"wrong", "login"=>"newbob", "password"=>"newpassword", "email"=>"newbob@mcbob.com"}, "action"=>"signup", "controller"=>"user"}, @request=#<ActionController::TestRequest:0x24d6894 @session_options={}, @accepts=nil, @symbolized_path_parameters={:controller=>"user", :action=>"signup"}, @query_parameters={"action"=>"signup"}, @host="test.host", @cookies={}, @env={"REMOTE_ADDR"=>"0.0.0.0"...
2007 Dec 01
5
specifying an HTTP status code
...r missing the point somehow: Is there a way in RSpec to specify that a controller action should use a specific HTTP status code? Specifically I want to test for the usage of 301 as opposed to 302, for a permanent redirection. response.should be_redirect looks like it calls ActionController::TestRequest#redirect?, which is only testing for a status code from 300..399. In an old-fashioned Test::Unit Rails test I could do assert_response, but I can''t see anything matching that in RSpec. Is there a less-documented feature I''m missing? Thanks, Francis Hwang http://fhwang.ne...
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 Jan 09
1
testing UrlHelper in ActionMailer
...ults in the controller @url anyhow. Any ideas how I can test this thing properly? Create a mock controller perhaps? Some method to set the controllers @url variable ...? I was trying this: class MockController < ActionController::Base @url = ActionController::UrlRewriter.new(ActionController::TestRequest.new, nil) end but I keep getting "MissingSourceFile: No such file to load -- url_rewriter" errors - I can''t work out how to pull in the UrlRewriter class ... Many thanks in advance. CHEERS> SAM
2008 Apr 11
4
request.params causing errors
Hello, I have a rhtml file that goes through the request.params. One of my test generates that file, but rspec pops an error saying : undefined method ''params'' for ... I''m not sure what to do with this, since request.params actually works with rails. Any idea? Thank you Olivier Dupuis -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Oct 12
2
Test should fail !
...39;alerts_controller'' # Re-raise errors caught by the controller. class AlertsController; def rescue_action(e) raise e end; end class AlertsControllerTest < Test::Unit::TestCase fixtures :clients def setup @controller = AlertsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end def test_get_index get :index assert_response :success end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the...
2005 Mar 09
9
Unit testing + instance variables
...end end >> # My test file require File.dirname(__FILE__) + ''/../test_helper'' require ''recipe_controller'' class RecipeControllerTest < Test::Unit::TestCase def setup @controller = RecipeController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new create_fixtures "recipes" create_fixtures "categories" end def test_list get :list # This step seems exessively complex, and took me a while to figure out my_inst_vars...
2006 Jul 02
5
"the number of parameters does not match the number of substitutions" error
...hought it happened when I upgraded to Rails 1.1.4, but it happens now when I downgrade to 1.1.2. Here''s test/functional/account_controller_test.rb: class AccountControllerTest < Test::Unit::TestCase def setup @controller = AccountController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end def test_index get :index assert_redirected_to :action => ''login'' # LINE 16 end def test_login get :login assert_valid_markup end end Any ideas? Thanks, Joe
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 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 Feb 08
10
Sharing sessions between subdomains?
Hello, I know how to share sessions between subdomains in PHP. Can anyone please guide me as to how I can share sessions using Ruby? Where can I set the value of domain for which the cookie is set? I would like for a user to login on the home page and then go to blog.home.com and not have to login again. Any guidance/pointers are appreciated. Thanks''
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