search for: load_and_authorize_resourc

Displaying 7 results from an estimated 7 matches for "load_and_authorize_resourc".

2013 Nov 22
2
Cancan Rspec load_and_authorize_resource
Hello! While running bundle exec rake, I receive following error (see in attached file) However, my tests are steel passing with command rspec spec/controllers/ Some info: ads_controller.rb: class AdsController < ApplicationController load_and_authorize_resource except: :create end ads_controller_spec.rb: require ''spec_helper'' describe AdsController do render_views describe ''Guest role'' do it "should not display link to new ad" do visit ads_path page.should_not have_content(''New...
2010 Nov 24
1
NameError in Devise/sessionsController#new
I created a sample application. Added devise in it, it works fine. Then added cancan gem into it. Created an ability class. define some permissions. Then added line load_and_authorize_resource to the Application Controller, after that when i go to the page http://0.0.0.0:3000/users/sign_in it gave the following error, NameError in Devise/sessionsController#new uninitialized constant Session Rails.root: /home/nazar/rails_projects/sample_can Please help me, i can not solve this issue....
2012 Mar 06
0
Devise/Cancan Signout User On Controller Action
...if user.role == 1 #admin can :manage, :all can :read, :all elsif user.role == 2 #Vendor can :manage, VendorTransaction can :index, Account end end end Ok Here is my Transaction controller require ''csv'' class TransactionsController < ApplicationController load_and_authorize_resource helper_method :sort_column, :sort_direction respond_to :html, :js def index per_page = 40 @transactions = Transaction.search(params[:id]).order(sort_column + " " + sort_direction) respond_to do |format| format.html # index.html.erb format.csv { render :csv => @transactions}...
2012 Oct 09
8
unexpected should_receive behaviour
Hi, surely I''m missing something... but what!? in my spec I''ve User.should_receive(:find).with("1").and_return(@user) and in my controller User.find(params[:id]) green light... correct... but if I change my controller using another method, for example first: User.first or even User.all I get green light too... I was expecting an error like expected: 1 time
2012 Mar 30
1
cancan breaks scoped mass assignment
...me attr_accessible attributes in order to avoid users to edit their roles or other sensitive information. From the administration I allow admins to edit those protected attributes by passing :without_protection => true on creation and update of new users. This works just fine, but adding cancan load_and_authorize_resource to my controller triggers a "Can''t mass-assign protected attributes: ...stuff..." . This happens also when using something like User.new(params[:user], :role => :admin) I really can''t figure out how to solve this, so any help would be very appreciated! Thanks in ad...
2012 Apr 05
5
rspec: identical tests fails when repeated
I''m doing RSpec controller testing with CanCan authorization, and I''m seeing something I''ve never seen in RSpec before: the same test run twice fails on the second one. I am NOT doing before(:all) or other things that should cause state to persist between tests: Here''s the relevant code: context "POST create" do context "with user logged
2011 Mar 30
0
Anonymous Subclass of ActionController::Base
I''m trying to spec a subclass of ActionController::Base using an anonymous subclass but I am running into errors but I am receiving a uninitialized constant StubResource Here is my base class class Admin::BaseController < ApplicationController before_filter :etherweb_site load_and_authorize_resource layout "admin/admin" protected def etherweb_site end end Spec: require File.expand_path(File.dirname(__FILE__) + ''/../../ spec_helper'') describe "Admin::BaseController" do let(:current_user) { logged_in(:role? => true) } controller(Admin:...