Displaying 20 results from an estimated 60000 matches similar to: "Setting headers in TestRequest"
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
2007 Jun 07
0
Functional Tests Fail - No URL can be generated for hash
Hi,
I''m just learning Ruby and Rails. I have developed a Rails application,
but not using the creation scripts that come with the rails
distribution. Consequently, no test scaffolding is available to me, and
I''m trying to write my functional tests from scratch.
I have what might be considered a standard plain old controller
(dashboard_controller.rb) that I''m trying
2006 Jun 16
0
rake spec controller test output hideus.
Is there any way to change the output of rake spec fails?
The errors are just totally over the top ugly and not helpful. First
of all the ruby -Ilib line always comes before each test and I find it
distracting. But if an error occurs on something that is not nil it
just gives me the entire contents of that object and that is no small
matter when the object is a HTTP request response.
Here is
2006 Sep 26
0
some help with functional testing of nested routes
I have the following functional test in test/functional for testing my
products_controller:
require File.dirname(__FILE__) + ''/../test_helper''
require ''products_controller''
# Re-raise errors caught by the controller.
class ProductsController
def rescue_action(e)
raise e
end
end
class ProductsControllerTest < Test::Unit::TestCase
fixtures
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
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
2008 Jan 12
0
Can't test application controller methods in functional tests?
I have two methods in application controller that I want to test from
ForumController:
-----------------------
class ApplicationController < ActionController::Base
...
def logout
session[:username] = nil
session[:admin] = nil
redirect_to(request.request_uri)
end
...
def home
redirect_to(:controller => ''forum'', :action =>
2008 Feb 08
0
Challenge! How can I write a test to test the methods in ApplicationController?
Hi all,
I''ve been Googling this one for a while now, and haven''t found a
satisfactory answer. It has been posted here before by someone else,
but it seems to have got forgotten, so here goes - perhaps someone can
think up a way around the problem?
In ApplicationController, I have the following method:
class ApplicationController < ActionController::Base
<snip>
2007 Jun 15
3
Error when running functional test - Errno::ENOENT
Hello,
I''m getting an error when running functional tests as follows, using
Mac OSX 10.4.9, Rails 1.2.3 .
When I run:
ruby test/functional/campaign_controller_test.rb
I get this error:
Started
E
Finished in 0.027402 seconds.
1) Error:
test_should_get_icon_data(CampaignControllerTest):
Errno::ENOENT: No such file or directory - /usr/src/projects/myproject/
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 Apr 27
6
Functional Test Problem. Nubee, please help
ALl my controllers require the user to be logged in. SO they will be
redirected to my "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 =
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/.
2008 Jun 30
0
request headersSo the
So the rdoc claims that a rails request object should have a headers
method, right?
http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html
**************
headers()
Provides acccess to the request‘s HTTP headers, for example:
request.headers["Content-Type"] # => "text/plain"
*************
Sounds simple enough. But when running in development mode on the
2006 Jan 09
1
testing UrlHelper in ActionMailer
Hi All,
So I found a helpful web page that explained how I could use things like
url_for in my mails:
http://wiki.rubyonrails.com/rails/pages/HowtoUseUrlHelpersWithActionMailer
However, I can''t test them properly. The problem is that when I create a
controller in my unit tests and pass it into the ActionMailer, it''s not
a real controller, set up as a controller is when it is
2006 Feb 07
0
scope problems testing a helper method that calls link_to()
We''ve been having problems writing functional tests for helper methods
that rely on ActionView methods. Here''s a specific example.
In application_helper.rb I''ve got a method called ''party_link()¨:
def party_link(party)
link_to party.full_name, { :controller => ''contacts'',
:action =>
2006 Jan 10
4
Problem creating MockController
Hi there,
I''m trying to create a mock controller to test the use of UrlHelper in
ActionMailer. I''m trying this:
require
''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
2006 Jan 14
0
testing template components
Hi,
I''m plowing through the template section of "Agile Rails", specifically the
stuff starting on P. 364. What is a good strategy for testing components?
My initial thought is to mimic the Rails application "test" directory. No
problem.
Next copy the setup method, and set it up like so -
class SidebarControllerTest < Test::Unit::TestCase
def setup
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
2006 Mar 26
2
Controllers in modules, not recognised - driving me mad!
Hi, I hope somebody can help me here but I''m having a very strange
problem getting Rails to recognise controllers inside modules. The
strange thing is, it was working the other day and I''ve not changed
anything as far as I''m aware. I''m running on OSX using Ruby 1.8.4 and
Rails RC1 (but I''ve also tried rolling back to Rails 1.0 and tried Edge
Rails)
2006 Feb 01
3
Testing components
I''m using template components to modularize an application I''m working
on and am really happy with the way it''s going. Unfortunately, all my
attempts at writing functional tests for them fail. Trying to duplicate
my normal controller tests I have:
require File.dirname(__FILE__) + ''/../test_helper''
require File.dirname(__FILE__) +