Displaying 20 results from an estimated 700 matches similar to: "Rspec and acl_system2 plugin"
2007 Jul 06
3
stubbing helper methods for View specs
Hi there
I have several view specs, that include the following snippet in
their "before" block to stub the methods by acts_as_authenticated
before :each do
@u = mock_model(User)
@u.should_receive(:name).and_return("Hans Muster")
template.should_receive(:logged_in?).and_return(true)
template.should_receive(:current_user).and_return(@u)
end
this
2006 Aug 05
2
acl_system2 undefined method `access_control''
I''ve installed acts_as_authenticated and have that working like a charm
and now would like to add the acl_system2 plugin so I can do some role
based authorization stuff.
I went ahead and installed the plugin like this:
>ruby script\plugin source http://opensvn.csie.org/ezra/rails/plugins/dev/acl_system2
Then I installed the lib and test
>ruby script\plugin install lib
>ruby
2007 Oct 18
0
ACL System restrict_to
Does the restrict_to method only work in the views for some reason? I
have tried it in the controller and i get the "undefined local variable
or method `restrict_to'' for Admin::SurveysController:Class" Ive even
copied the code from the access_control.rb in the plugin to the
application_helper but it still keeps giving the same error.
def restrict_to(logicstring, context = {})
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
2007 Aug 23
0
how to manage group permissions?
Hey all,
In my app users can create groups and the group creator can "kick" or
"ban" users. I want the creator to be able to grant other members of
the group to kick and ban.
This is how I want to do it:
I''m usgin acl_system2 and the creator can grant kick and ban
permissions to group members by creating roles "kick_group_id" or
"ban_group_id" for
2006 Jul 14
1
role-based conditionals
in the Rails Recipes book there is a chapter on role-based
authentication. it basically set up priviliges based on what page the
user was able to access. i went through the chapter and felt like i got
a pretty good understanding of how to do it.
now i am needing something a little more advanced though. instead of a
per page (or action) i would like to have certain sections on a page
either
2006 Aug 01
2
HOWTO? security based on data values
Hi!
I recently started with RoR and this may be a newbie question.
I have a company table, employee table and transactions table.
1 company has many employees. Each employee performs many transactions.
Employees from different companies LOGIN to the system to record their
transactions. Employees can search on all transactions associated to
their companies (indirect relationship via employee),
2006 Sep 02
1
html not rendering apache/mongrel
We are running Apache and Mongrel on RHEL4 and have been experiencing
some interesting behaivor. Sometimes when someone logs into our
application (it uses the acts_as_authencticaed and acl_system2) the
following happens. Instead of the browser rendering the html and
displaying all the form elements corretly as you would expect, it simple
spews back the output without attempting to render. So
2007 Jul 24
6
Mocking Access Control
I''m trying to jump on the TDD/BDD bandwagon, but am having trouble
understanding how i should mock my user. The user has a habtm
relationship to a roles model (acl_system2 plugin), but I''m not sure
how to tell rspec about a model.
My code:
describe UsersController do
integrate_views
before(:each) do
@user = mock_model(User)
2007 Mar 06
15
mocking missing methods
Hi folks.
So I''m using mocha on a ruby project, and I really like it. One thing
I''ve noticed is that it can be a bit "surprising" when I''m mocking
methods that don''t exist on an object, and I think there''s an easyish fix.
At the moment, you use sheep = mock() to create a mock sheep. What I''d
like to do is something like sheep =
2007 Aug 08
3
rspec with autotest on a windows machine
Hello all,
I''m new to rSpec but after reading a couple of tutorials I''ve become
enamored. Anyway, I am at minute 42 of the rSpec basics screencast (
peepcode.com) and I''m having the following error running autotest w/rSpec:
D:\ruby\projects\forecaster>autotest
loading autotest/rails_rspec
c:\ruby\bin\ruby -rrubygems -e "require ''redgreen''"
2007 Oct 10
2
RSpec seems to be having a hard time loading Helper classes
I am getting the error when I run the command: rake spec
This is a new project with not current test written besides the ones
auto-created for me.
+++++++++
$ rake spec
(in /Users/chrisolsen/Projects/Rails/chrisolsen/trunk)
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in
`load_missing_constant'': uninitialized constant ProjectsHelper
2006 Mar 22
4
Problem with ACL plugin system
Don''t know if anyone else has experienced this but I''m having a problem
with the access_denied method in Ezra''s ACL access control plugin. It''s
working fine (in conjunction with acts_as_authenticated) until it comes
across a user it denies access to, in which case it throws the following
error:
NoMethodError in Admin#index
protected method
2006 Mar 06
20
How painful is the 1.0 -> 1.1 upgrade going to be?
Does anyone have a sense for how painful the 1.0 -> 1.1 upgrade is
going to be for existing apps? I''m finishing up my first real RoR
application with Rails 1.0. I can live with it staying at that level,
but I really want to use the has_many :through attribute to clean up
some of my code.
I''m not particularly interested in edge Rails, mainly because the
documentation for
2006 May 02
3
Writing tests for plugins
I''ve been googling around trying to find some tips on creating tests for
plugins. Am I correct in assuming that I''d have to have the tests as
part of a rails app in order to test the plugin? I''d like to find a way
to do standalone tests for the plugin.
--
Posted via http://www.ruby-forum.com/.
2007 Apr 30
4
Mocking with Calculated Results
I am setting up an AR mock object and wanted to sanity check it. My
intent is to mix this into all my examples and then override/add
methods where necessary. Note that I''ve anticipated three cases for
find:
find with one numeric argument => object
find with :all => Array
find with anything else => nil
This roughly approximates how ActiveRecord::find works in this case
2010 Jul 13
2
[Rspec] Difference between stub and message expectation with any_number_of_times
I''m wondering what''s the difference between stub and message expectation
with any_number_of_times, for example:
myMock = mock("mymock")
myMock.stub!(:is_a?).with(MyClass).and_return(false)
and
myMock = mock("mymock")
myMock.should_receive(:is_a?).with(MyClass).any_number_of_times.and_return(false)
because is_a? may not be called at all, it just like a
2006 Nov 10
2
mock syntax order
I have the following statement
mock_requester.should_receive(:request_with).with
("x").any_number_of_times.and_return(@object)
which works fine, but when i do it backwards, which makes the same
amount of sense syntactically, it fails
mock_requester.should_receive(:request_with).with("x").and_return
(@object).any_number_of_times
are all of the mock options
2007 May 23
2
rspec mocha and controller specs without integrated_views
The ability to choose a mocking framework is great as I prefer mocha, but I
am have problems.
On my controller specs, I am forced to ''integrate_views'' as the following
code below shows you, the mocking of views is rspec specific. See stub!
versus mocha''s stub
unless block_given?
unless integrate_views?
2007 Sep 30
9
Problems with testing nested routes using mocking
Hello forum
I have there to files
#----- virtual_host_controller.rb
class VirtualHostsController < ApplicationController
before_filter :capture_domain
# GET /domain/1/virtual_hosts/1
def show
@virtual_host = @domain.virtual_hosts.find(params[:id])
respond_to do |format|
format.html # show.rhtml
end
end
private
def capture_domain
if