similar to: assert_redirected_to behaviour

Displaying 20 results from an estimated 30000 matches similar to: "assert_redirected_to behaviour"

2006 Jun 30
4
Strange behaviour from assert_redirected_to
I have this assertion in my tests: assert_redirected_to :controller => ''user'', :action => ''change_password'' It fails with: response is not a redirection to all of the options supplied (redirection is <"http://test.host/user/change_password">), difference: <{:controller=>"user"}> The redirection was: redirect_to
2006 Aug 03
2
Failing test with assert_redirected_to
I''m having a strange problem with an assert_redirected_to in my controller test which hopefully someone can point out my failings with! ;) Controller method - def new if request.post? #Not important here. else flash[:notice] = ''Please join a tree from this page.'' redirect_to :controller => ''trees'', :action =>
2010 Aug 16
0
assert_redirected_to partial assertion does not work?
Hi, From the docs I see: http://api.rubyonrails.org/classes/ActionController/Assertions/ResponseAssertions.html This match can be partial, such that assert_redirected_to(:controller => "weblog") will also match the redirection of redirect_to(:controller => "weblog", :action => "show") and so on But it my case it does not work. As
2007 Jan 09
1
assert_redirected_to not working as expected
I''ve installed the "acts_as_authenticated" plugin and made some modifications to the controller (app/controllers/account_controller.rb) "signup" module as follows: === def signup @page_title = ''Create Account'' @user = User.new(@params[:user]) if request.post? if @user.save session[:user] = User.authenticate(@user.login,
2006 Jul 11
0
assert_redirected_to not recognizing routes
I''m getting a weird error in a call to assert_redirected_to in one of my functional tests. Here is the test: def test_signin admin = users(:adminuser) post :signin, {:login => admin.email, :realpass => @password} assert_redirected_to :action => ''list'' # failure happens on this line assert_equal admin.id, session[:user].id end The error
2010 Feb 19
2
Problem with assert_redirected_to
I have taken over some old Rails code and am trying to get the tests to run. In the functional test every time the assertion ''assert_redirected_to'' is called I get the following error: test_should_update_venue(VenuesControllerTest): NoMethodError: undefined method `[]'' for #<Enumerable::Enumerator:0x102f747e0>
2006 Dec 11
1
assert_redirected_to error
I''m new to TDD in rails, I''m getting this weird error with assert_redirected_to. Here''s my test: def test_friendship_request_accept @request.session[:user] = users(:nathan).id get :accept, { :id => 1 } assert_redirected_to :controller => "/users/profile", :action => "index", :id => users(:nathan).id end When I run this I
2006 Jun 17
3
What is this failure trying to tell me?
Here is my unit test code. post :login, :user=>{ :login => "bob", :password => "test"} assert_response :redirect assert_session_has :user assert_redirected_to :action => ''welcome'' Here is the failure I''m getting when I run my tests. 2) Failure: test_login_required(UserControllerTest)
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
2006 May 25
0
Test redirect_to fails
Hi I have a weird issue on functional testing Here is the redirect I have in my controller: redirect_to :controller => "/param/user", :action => :edit, :id => @current_user.id And here is my functional test: assert_redirected_to :controller => "/param/user", :action => :edit, :id => users(:vincent).id And when I run test I have this error
2008 Dec 05
4
Replicating Form Behaviour in Functional Test
Hi, I''m really struggling getting a controller test to pass while the form that uses the method operates correctly. I would really welcome a second pair of eyes to help me find out what I''m missing. The test def test_set_password @request.session[:user] = users(:admin) put :set_password, :id => users(:one).id, :user => {:password => "newpass",
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 Jun 29
1
Problems getting past authentication using functional tests
Hi, I''m having a problem getting past the authentication mechanism in rails using my controller functional tests. my functional tests look like this def test_4 $stdout.puts ''TEST 4: cookies is '' + cookies.to_s # :user => {:id => users(:testuser).id} cookies[:user_id] = ''2222'' $stdout.puts ''1. cookies is ''
2006 May 10
0
Ezra''s acl_system2 and flash not getting populated in functional tests
Hi all, I am using the LoginGenerator and Ezra''s acl_system2 to protect certain actions in my controllers. I have written some functional tests to check for correct handling of redirects, flashes, etc. The flashes however only get populated on the first get action in any given test. Here is what I have so far: In the controller: class PageController < AC before_filter
2013 Sep 23
1
redirect on browser success, but redirect on functional test is error
line_items.yml: one: product_id: 1 cart_id: 1 quantity: 1 carts.yml: one: {} product.rb: has_many :line_items cart.rb: has_many :line_items, dependent: :destroy line_item.rb: belongs_to :product belongs_to :cart line_item_controller.rb: def destroy @line_item = LineItem.find(params[:id]) @cart = @line_item.cart @line_item.destroy respond_to do |format| format.html
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 + '' '' +
2008 Feb 05
1
Functional Test has error when testing controller updates_attribute of its parrent.
I am working in Rails 2.0 and I have the following functional test. class VotesControllerTest < ActionController::TestCase def test_should_create_vote assert_difference(''Vote.count'') do post :create, {:vote => {:vote_value => 5, :user_id => users(:nick).id, :entry_id =>
2006 Sep 11
2
unexpected behaviour when defining a function
Hi, I know S manuals used to warn against using the same names for a variable and a function, but I have never seen that cause problems in R, so I usually don't pay much attention to it. Which is why the following behaviour came as a surprise: > bar <- function() 1 > foo <- function(bar = bar()) { + bar + } > foo(9) [1] 9 > foo() Error in foo() : recursive default
2009 Jan 19
1
in functional test, assert_redirected_to w prefix
I had to use sub-URI deployment (could not use subdomains..), and when running my functional tests, I the redirected_to assertion embed the prefix.. quite normal ;-)) is there a way to stipulate this prefix in the test setup to avoid hard-coding in all the tests ? Expected response to be a redirect to <http://test.host/my/page> but was a redirect to
2007 Dec 24
1
Uninitialized constant in integration test
I am seeing weird issues when trying to create integration tests. Here is a very simple example of something that is failing. The assert_redirected_to, and other methods, fail with this or similar exceptions. I have tried requiring both ''application'' and ''listings_controller'', but neither solves this problem, although the exception changes. Anybody know