Displaying 20 results from an estimated 200 matches similar to: "Accessing the params hash in a functional test not working"
2006 Mar 15
2
Session (stored in db) not working in testing mode
Hi,
I just switched from storing my sessions on disk to storing them in
MySQL. Changing environment.rb ''config.action_controller.session_store =
:active_record_store''. But now all my tests fail. I get the following
error:
1) Failure:
test_authorized_new(AdControllerTest)
[c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/depr
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 Jun 29
0
acts_as_authenticated, reset_session, and redirect_back_or_default
Just a question and an FYI
I just installed rails and acts_as_authenticated and was setting up a
site. Everything works fine except that in the AccountController that
I generated the calls to the routine redirect_back_or_default don''t
work because the call just before it to reset_session clears the
session[:return_to] that the method uses to set where it will
redirect.
I ended up adding
2006 Mar 21
1
Functional Test: post - Other controller
Hi All
I''m attempting to get all of my tests clear after installing the Salted Hash
Login generator. Now I''ve protected the entire application so login is
required from all points. However I get a fail 302 on all other protected
controllers as I haven''t explicitly logged in and got the session.
I thought adding the following to the beginning of my methods in the
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
2010 Feb 19
0
You are being redirected
I have done something to my application controller so that instead of
the redirected page itself am now seeing this as a response:
<html><body>You are being <a href="http://www.example.com/
welcome">redirected</a>.</body></html>
I do not know why this is happening or what I did to trigger this
behaviour. The API does not give me any clues as to
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
Hi,
I just installed Rails 2.0.2
[root@mymachine easyx]# ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
[root@mymachine easyrx]# gem install rails --include-dependencies
Need to update 16 gems from http://gems.rubyforge.org
................
complete
Successfully installed rails-2.0.2
[root@remandev easyrx]#
But I''m getting this error in my restful_authentication
2006 Nov 08
1
controller.session not same as session?
> context "A user logging out" do
> fixtures :users
> controller_name :account
>
> setup do
> login_as :quentin
> users(:quentin).remember_me
> request.cookies["auth_token"] = cookie_for(:quentin)
> end
>
> def logout
> get :logout
> end
>
> specify "should unset :user in session" do
2007 Feb 21
1
setting session data from a post
I''m using acts_as_authenticated, and I''m trying to run some tests where
the user must be registered. In the past, I''ve just included a user id
in the session data.
def test_login_loads_from_post_session
post :new, nil, { :user => 7 }
session = assigns(:session)
assert_equal 7, session[:user]
end
My assert statement seems to be failing because my session is
2006 May 04
2
Testing associations
I have a pretty simple model, articles and users.
class Article
belongs_to :user
end
class User
has_many :articles
end
In my unit tests I want to ensure that the associations work properly.
What''s the best way to do this? The obvious thing to do is a test in
each model.
# user_test.rb
def test_add_post
u = users(:first)
before_articles = u.articles.count
u.articles
2006 Feb 28
1
Oracle OraNumber problem with Authentication. Please help!
I have added an authenticator using the instructions here:
http://wiki.rubyonrails.org/rails/pages/HowtoAuthenticate
The LoginController sets session["employee"] to an employee.
When i try to access the session["employee"] from another controller i
get this error :
"
TypeError (no marshal_dump is defined for class OraNumber):
c:/ruby/lib/ruby/1.8/pstore.rb:159:in
2005 Nov 25
0
Login Authentication working in IE but not in Mozilla
I have gone through the following site for the creation of my login
page:
To mention I am using Windows XP pfofessional running on WEBBrick server
http://wiki.rubyonrails.com/rails/pages/HowtoAuthenticate
The code is given in the following 3 steps:
1)The controller that needs protection:
class WeblogController < ActionController::Base
before_filter :authenticate
def index
# show
2005 Dec 23
1
Salted Login Error
Anyone know what''s causing this?
------------------------------------------------------------------------
1) Error:
test_delete(UserControllerTest):
NoMethodError: undefined method `advance_by_days='' for Time:Class
./test/functional/user_controller_test.rb:132:in `test_delete''
2) Error:
test_signup(UserControllerTest):
NoMethodError: undefined method
2008 Mar 01
0
Fixtures in ActionController::TestCase
Hi guys,
Need some help.
I am using Rails 2.0 and while writing functional test, I encountered
the following problem
class UserControllerTest < ActionController::TestCase
fixtures :users
...
def do_something
attempt_login(users(:valid_user)) # assuming valid_user is a
proper line in
...
end
def attempt_login(user)
post :login, :user => { :login => user.login, :password
2004 Oct 24
0
redirection bug ?
Hi
I use code from authentication example from ruby on rails web page.
Everything looked fine until i found thet when i log for the first time it
gives me bad redirection. When session[''return_to''] was set everythig
had been fine so i changed (look into my code) from 1 to 2.
this is from login controler
def login
if
2006 May 08
3
operator overload on views
In my User auth scheme I have a userlevel. I''ve overloaded the User
class operators like this:
def >(item)
if item.class == "User"
self.userlevel > item.userlevel
else
self.userlevel > item
end
end
(other operators are overloaded in essentially the same way). As I
understand it, using the operator ">" inside the overloaded
2005 Jul 05
2
Salted hash login generator (verification problem?)
Hi all,
I hope someone can help with what is probably a simple newb
installation mistake on my part. I''m having a couple of problems with
the salted hash login generator. I installed it following the
quickstart guide, and the unit tests work like a charm. There are two
errors and a failure on the function tests, though; the verified field
seems to be involved in at least one of
2006 Jul 04
1
LoginGenerator Problem
I am trying to make a barebones login system based on this example
(which in turn is just standard RoR login) but when I enter a user name
and password, it says the login is unsuccessful every time. I am not
sure where I am going wrong. Here is all relevent information
CREATE TABLE `users` (
`id` int(6) unsigned NOT NULL auto_increment,
`login` varchar(20) NOT NULL default
2008 Mar 07
0
ActiveRecordStore: cleanup & avoiding duplication
Hi,
I''m using ActiveRecordStore to track user sessions.
I''ve used as a base the next sources:
- http://blog.levicole.com/articles/category/ror
- http://matt-beedle.com/2006/12/13/rails-how-to-find-out-who-is-online/
- http://www.williambharding.com/blog/?p=99
This is what I currently do:
IN SESSION CONTROLLER
def create
self.current_user = User.authenticate(params[:login],
2006 Jan 27
1
Multiple Database write question
I am working on reconfiguring an app that we are about to release to
work tighter with another app that we already have. Both of these
apps are going to share a single users database that stores the
general information about the user such as login, password, name,
email and so forth. They also have app specific stuff that is
attributed to the user that is stored in the app''s own