similar to: Problem with assert_redirected_to

Displaying 20 results from an estimated 400 matches similar to: "Problem with assert_redirected_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
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 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
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 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 Jul 02
5
"the number of parameters does not match the number of substitutions" error
All of a sudden, I''m getting this error: 1) Error: test_index(AccountControllerTest): RuntimeError: The number of parameters does not match the number of substitutions. /home/joe/projects/tanga/trunk/config/../vendor/rails/actionpack/lib/action_controller/assertions.rb:92:in `assert_redirected_to''
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 Mar 22
0
assert_redirected_to behaviour
Consider following situation: you''ve got controller Foo that has following routing rules related: map.connect ''/foo'', :controller => ''foo'', :action => ''index'' map.foo ''/foo/:x/:y/:z/:action'', :controller => ''foo'' You want all Foo actions to make use of partial url rewriting, so instead
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)
2009 May 02
10
Problem verifying routing error
Hi, When upgrading to rspec/rspec-rails 1.2.6 gem (from 1.1.12), I''m having a new problem verifying routes that should not exist. This is to support something like this in routes.rb: map.resources :orders do |orders| orders.resources :items, :except => [:index,:show] end I used to use lambda {}.should_raise( routing error ), but it stopped detecting any raised error.
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
2005 Mar 06
3
question about testing
Ok, so now I''m learning about testing. After a few initial hiccups, I''ve got my tests written nicely and all the assertions are passing. But I just have one question about doing tests in a loop. In my setup, I''m using the login generator to protect ''sensitive'' actions, while some actions are public. So I''ve got this line in my setup method:
2011 Aug 04
3
#create tests fail when I add FriendlyId to my model
I am doing controller testing, and I can''t seem to get the create method test to pass when friendly_id is added to the mix. If I comment it out of the model, the tests all pass perfectly. The moment I add it back in, the error looks like this: 1) Error: test_create_valid(BrandsControllerTest): FriendlyId::BlankError: FriendlyId::BlankError
2006 Feb 08
1
functional test problem
I am trying to write a test for my delete method. I find a User in the db by its id, do the delete action, then I want to see if it is still in the db. How do I check that the User IS Deleted without causing errors? ** My Test ******************************** def test_delete_user login user = User.find(2) post :delete_user, {:id => user.id} assert_equal "User
2013 Apr 12
1
What is the meaning of the method to_param?
Hey! Foe example i have next code: test "should update user" do put :update, id: @user.to_param, user: @input_attributes assert_redirected_to users_path end What return id: @user.to_param? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group
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
2005 Dec 23
6
Agile book - test error
Hi all, I get an error when testing the "store_controller_test.rb" The troublesome line is in the test below: def test_add_to_cart get :add_to_cart, :id => @version_control_book.id <<< cart = session[:cart] assert_equal @version_control_book.price, cart.total_price assert_redirected_to :action => ''display_cart'' follow_redirect
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 + '' '' +
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 =>