Displaying 20 results from an estimated 1000 matches similar to: "Challenge! How can I write a test to test the methods in ApplicationController?"
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 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__) +
2006 Oct 26
2
Mocha and SimplyHelpful
Hi,
I''m getting a conflict between the Mocha plugin and the Rails
SimplyHelpful plugin.
For some reason the dom_id method from SimplyHelpful is not being
found in my views when the Mocha plugin is installed. The dom_id
method if used in the controller works properly.
This is the error I get when running the tests:
1) Error:
test_truth(HmmControllerTest):
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
2010 Apr 05
1
`test': wrong number of arguments (1 for 2) (ArgumentError)
Hi,
Im trying to change the syntax of my tests to the
test "some method" do
...
end
syntax from the existing
def test_some_method
...
end
syntax. Im pasting my test code below. Im getting the error in the
subject line if I try to run the test as a ruby script from the
console.
require File.dirname(__FILE__) + ''/../test_helper''
require
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
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 =>
2006 May 19
1
Strange error when testing layered web service
Hi all,
Ruby 1.8.4
Rails 1.1.2
1) Error:
test_find_hardware_by_id(HardwareControllerApiTest):
ArgumentError: illegal refid http://test.host/
c:/ruby/lib/ruby/1.8/soap/baseData.rb:166:in `decode''
c:/ruby/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:153:in
`decode_tag''
c:/ruby/lib/ruby/1.8/soap/parser.rb:179:in `decode_tag''
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/
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
2004 Nov 20
0
Stack level too deep on Cygwin and on Debian / Colinux with 0.5.0 - 0.8.5 Beta gems
Hi,
as it is not possible for me to use a sensible development environment
to start with I have to use emulations. I use Cygwin on windows and also
Colinux. (Colinux is really amazing cause it lets you run actual linux
binaries und Windows.) So here is my problem, which by the way exists
since Rails 0.5.0 I think. It was the reason I tried Colinux in the
first place, cause the error first
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 Apr 14
8
Error with Web Service tests after upgrading to Rails 1.1.2
Hello.
I hope this is the right place to describe my problem ?
After upgrading to Rails version 1.1.2 from rails version 1.0.0, Web
Service functional tests seem broken.
I upgraded rails (as the root user / administrator) with:
# gem update rails --include-dependencies
then I upgraded my application (as myself) with:
? rake rails:update
% rake rails:update:configs
After these steps,
2006 Feb 26
0
rescue_action with RoutingError not loading ApplicationController/ApplicationHelper
Why is it that when rescue_action is called with any exception except for
RoutingError, "self" refers to a controller within my application, but when
there''s a RoutingError, "self" refers to an object of
ActionController::Base? This makes some sense because a "RoutingError"
implies that no controller was found to process the request. However, I am
trying to
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
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 =>
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 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)
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