Displaying 20 results from an estimated 1000 matches similar to: "Functional test issue for testing newbie"
2009 May 18
0
[PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
src/test/functional/host_controller_test.rb | 41 --------------------
.../functional/managed_node_configuration_test.rb | 14 ++++---
src/test/functional/nic_controller_test.rb | 8 ----
src/test/functional/permission_controller_test.rb | 15 ++++---
src/test/functional/quota_controller_test.rb | 2 +-
2006 May 07
0
NoMethodError trying to get ApplicationHelper method from a functional test
I am a little confused by the includes I suspect. In the book, it states
that runtime environment will load the directories app, app/models,
app/controllers, app/helpers, app/apis, components, config, lib, vendor and
vendor/rails/*.
However, when I try to access my "current_project" public method, it fails
with a NoMethodError.
What is even stranger is that I can use reflection to find
2006 Aug 08
4
Creating a child simultaneously with parent via form
Hi there
I''ve got a user model and an address model; a user has_many addresses.
A user object can be created via an html form which also allows for an
initial address to be created.
I''ve got a controller method working to save both objects via the
form, but I suspect I can achieve this in a more rails-esque manner.
Here is my controller method:
def signup
@user =
2007 Jan 11
0
Functional tests with actions that send files
I have a number of actions that use the spreadsheet/excel library to
generate an Excel spreadsheet based on model data and send it to the
user using the send_file method.
For a while, I''ve been testing these methods with assert_response
:success, and then checking the response headers to make sure the file
at least looks like what I should be getting. But it occurred to me
recently that
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
2007 Jan 26
0
Problems with assert_select in integration tests
I''ve been battling with assert_select in my integration tests for
several evenings now. I''m testing a multi-step form, and after
submitting the first step, my assert_selects fail on the attempts to
find the form on the next page. However if I print out the response
object, it has the exact text of what I''m trying to match.
Here is the complete integration test. The
2006 Aug 04
2
Functional Testing Anomoly
I have a test method (below).
def test_save_failed
post( :edit, :record => StatusChanger.invalid_data_hash)
assert_response :success
assert_template ''edit''
assert assigns(:record)
assert_equal false, assigns(:record).valid?
end
This particular method is part of a larger set of functional tests. If
I run,
$ ruby controller_test.rb -n
2006 Apr 04
1
integration tests - 1.1
I?m using the new 1.1 integration test facility? I?m trying to write a
test that sees if a controller redirects to the correct place and
preserves the query string.
Here?s the code:
class LoginRedirectTest < ActionController::IntegrationTest
def test_non_admin_auth
request_uri = "/datafeed/event/report?blah=blah"
get(request_uri)
follow_redirect!
2006 Jul 06
6
Functional tsts
Hi all,
I have created projects module in my application using scaffold,
and it created me everything, and all the modules are working except the
functional test. This is the error
1) Failure:
test_create(ProjectsControllerTest)
[test/functional/projects_controller_test.rb
:55]:
Expected response to be a <:redirect>, but was <200>
8 tests, 25 assertions, 1 failures, 0
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 =>
2007 Jan 21
0
Functional Test Fails with before filter in application.rb
Hi There,
I am trying to write my first tests for a role bassed authentication
taken from Rails Recipies. Whenever I add:
assert_redirected_to :action => ''login''
I get the following error:
NoMethodError: undefined method `first'' for :user:Symbol
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/assertions/response_assertions.rb:72:in
2009 Apr 21
2
validates_uniqueness_of
hello all,
i am new to RoR programming and am struck with the functional test whole
checking for uniqeness of carriers. If it is not unique,the the bin
shudn''t be created.Can someone help me in correcting my code.
def test_create_failure_cycle_unique
begin
num_bins = Bin.count
post :create, {:bin => { :carrier => carriers(:A), :cycle =>
cycles(:one), :name =>
2010 Aug 09
0
Exceptions in functional tests (rescue_action_in_public! broken?)
In 2.3, exceptions raised by controllers under functional tests were by
default propagated to the test, but by using rescue_action_in_public! a test
could trigger the production, public behavior and then use assert_response
or similar to test the expected result. This was implemented via
coordination between ActionController::Rescue and
ActionController::TestCase::RaiseActionExceptions.
This
2006 Oct 21
6
test_create gets 200 instead of :success
Help!
I have a new/create process that works fine in the actual app. But when
I test I always get a failure in the test_create section. Here''s some
controller code:
def new
end
def create
begin
@borrower = Borrower.new(params[:borrower])
if @borrower.save
flash[:notice] = ''Borrower '' + @borrower.FirstName + '' '' +
2006 Jul 05
2
How to write get functional test when there is no action by that name
I have following line in route.rb
#event info for an event name
map.connect ''event/:name_url'',:controller => ''home'',:action =>
''event_info''
It causes a URL like http://localhost:3000/event/_jewels_exhibition_ to be
sent to the home controller with action as ''event_info''.
I am trying to test this action. My first
2006 Jan 10
0
problem with cookies in tests (TDD)
The problem I''m having is that I can''t seem to destroy the cookies and
assert that they were indeed destroyed inside the test.
The code to do this does work - the cookies are created, and are
destroyed when this is done in a browser, but I can''t seem to make the
test pass.
account_signup_test.rb
def test_should_pass_if_logout_destroys_cookie_data
post :login,
2008 Apr 01
2
Functional Testing - page actions
Pretty simple question, I''ve tried to ajaxify some actions and the first
one I did was a delete -
def delete_job
.....
render :update do |page|
page.remove "job_#{id}"
end
....
end
and in my functional test I call this function via post
def test....
post :delete_job, :id => 1
assert_response :success
......
end
after the assert_response, how do I test that the page
2007 Mar 31
0
routing problem with controllers in other dirs
Hi all
I have a problem with mapping url to controller which is deeper in
controller directory (not root directory). I wanted to move
acts_as_authenticated account_controller deeper to directory (let''s
call it Foo) and route it as /Foo/Account, but i always seem to get
exception that no route matched my request
file structure:
/app
+- /controllers
+- /Foo
+-
2006 Jun 29
0
@response.body accumulating in functional tests?
I have two functional tests for my user controller:
def test_bad_registration
post :register, :email => "tester1@foo.com"
assert_response :success
assert_not_nil @response.body =~ /^\<error/
assert_nil assigns[''user'']
end
def test_good_registration
@response.body = nil
post :register, :username => "tester",
2005 Dec 14
1
Problems with testing - error posting to other controller
Hi,
I''m trying to test my ad_controller. In order to create an ad, the user
has to be logged in, so I have written a login() that logs in a valid
user and generates a session[:user_id], like:
def login (login="bob", password="atest")
post "user/login", :user => { :login => login, :password => password
}
assert_response 302 # redirect