Displaying 20 results from an estimated 10000 matches similar to: "before_filter not executed in functional tests"
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 ''
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 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
2006 Jan 30
5
Functional tests and dealing with login before_filter
Hi all,
I''m curious as to how you do functional testing on the controllers if, within
the ApplicationController, I have a before_filter :authorize, :except =>
:login, where the private authorize method checks for session[:user].
I can''t do "post :login", because that method is in a different controller.
I tried setting session[:user] directly in the setup
2008 Nov 06
0
Restore password without session initialized
Hi,
Y was triying to implement in my application the fact of remenber or
generate a new password. When you try to loggin in there, if the
password is no correct, the application shows the link "Remenber
password", having the route /users/remind. The problem is when a try to
go to this link, appear an error like this:
undefined local variable or method `new_session_path'' for
2006 Jul 14
4
sending additional parameters to before_filter
i am trying to create a system so that different users have different
priviliges on my application. i was going to modify my authorize
function so that i could pass the required role to it and have it check
the current user for that role.
i am using before_filter and would like to have just one function
instead of writing one for each role like so:
authorize(role)
instead of:
2006 Jan 11
7
before_filter: how to give :except more than 1 value?
Hi all
I have the following class:
class MemberController < ApplicationController
before_filter :authorize, :except => :index
def index
...
end
Now I want to give the before_filter more than one :except argument. I
tried :except => {:index, :login}, but this didn''t work.
How can i accomplish this?
Thanks a lot and have a nice day,
Josh
--
Posted via
2006 Nov 21
2
before_filter in actionwebservice controller using direct dispatching
The docs say that for direct dispatching mode to use controller
filters, but when the controller is run I get the following error.
The authorize method is in application.rb. Works fine when it''s not a
web service api. Should I be using before_invocation instead even
with direct dispatching mode? Or can I not have the authorize method
in application.rb?
undefined method
2008 Jun 13
3
before_filter order of execution
Hi
I''m trying to use before_filter to allow access to a site. Only logged
in users can view any object in the controller, but only users with a
access_level higher than 2 can view specific objects. My code is:
-----------------------------------------------------------
IN USER_CONTROLLER
before_filter :login_required
before_filter :access_granted, :only => [:destroy, :new , :edit]
2008 Jan 30
1
Can before_filter using Proc and specify block ?
Hi,
I see from this post
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/97e333daab05b725/8252c90cb9c36f6d?lnk=gst&q=passing+parameter+before_filter#8252c90cb9c36f6d
it can specify the Proc in the before_filter function, but when
specify when action apply this filter, it raise an syntax error, such
as rthe following code
before_filter {|controller|
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 +-
2007 Dec 03
2
before_filter application => exclude some other controllers
Hello again,
It''s possible to use before_filter in the application_controller, and
exclude for some methods from other controllers ?
i have a before_filter in application_controller that checks if the user
is logged, if the time hasn''t expired, ... and I want to exclude some
methods of this check, like the login. This ''login'' belongs to other
controller.
I
2006 May 16
2
before_filter and the application controller
Hi there,
I''m having a bit of an issue with my before_filter. I know that the filters
put in the application.rb controller are global for all the controllers. In
my application filter I''d like to allow access to the RSS feed method in a
''member'' controller and skip the login checks that the before_filters are
currently performing.
In my application my filters
2006 Mar 10
3
before_filter question
Let''s say I''m using before_filter in my controller:
before_filter :setup
def setup
# do something here
end
Is there any way my setup method can know which action is really about
to be called? Let''s say I want to log out which action is going to be
called, how can I know that in the before_filter method? (My question
is not really about logging,
2008 Oct 25
1
Returning a variable to before_filter
I know its probably doesnt sound right, but I am trying to call a
before_filter method that will check whats the user role and then
based on that return a string / hash / array to the before_filter
something like this:
class MonqiClassesController < ResourceController::Base
before_filter :check_user_access_level , grant_access
def check_user_access_level
if
2007 Mar 20
1
Passing Arguments to before_filter
I want to put a before_filter in application.rb, as follows:
before_filter :do_something, :except_controller => [:admin]
def do_something(options)
options.stringify_keys!
unless options[:except_controller].include?(controller_name)
# do something useful
end
end
Where I''m blocking is on how to get the ''options'' data in the do_something
method. I think I
2006 Feb 27
3
Send parameter along with method in before_filter
Hello list,
I have an app that has a very simple authorization scheme. A person can have
many roles and roles can have many people.
In my app, I''d like to do
before_filter :login_required (since no role name is provided, it accepts
any users with credentials)
before_filter :login_required ("administrator") (only accepts those with
role administrator)
before_filter
2006 Apr 17
2
newbie before_filter question
I''ve successfully gotten acts_as_authenticated working. Currently the
before_filter line for my admin screen is like this:
class AdminController < ApplicationController
include AuthenticatedSystem
before_filter :login_required
Only issue I have now is that anyone logged in can access that screen.
I''d like to differentiate between a regular user and
2006 Mar 30
1
flash, before_filter and redirect_to
I leave a notice in the flash and do a redirect from a before_filter.
Can someone confirm that the first request after this, i.e. the page I
redirect to, doesn''t/isn''t supposed to clear the flash?
--
View this message in context: http://www.nabble.com/flash%2C-before_filter-and-redirect_to-t1367103.html#a3665933
Sent from the RubyOnRails Users forum at Nabble.com.
2006 Aug 03
1
strange before_filter error. is this a bug i have found?
...
before_filter :find_regression_test
def find_regression_test
@regression_test=RegressionTest.find(8)
end
....
The above seems like perfectly normal before_filter syntax, but it gives
this error. Aldo is no application trace, just a framework trace:
Any idea what is wrong?
NoMethodError in Regression testsController#modify_regression_test
private method `equal?''