Sha256: b5f94d014cf792acb4ddbe817c1d7133df7ac8ee6e82e336fa2e09b3b95e65c4
Contents?: true
Size: 869 Bytes
Versions: 46
Compression:
Stored size: 869 Bytes
Contents
require 'spec_helper' describe ActiveAdmin::CanCanAdapter do describe "full integration" do let(:application){ ActiveAdmin::Application.new } let(:namespace){ ActiveAdmin::Namespace.new(application, "Admin") } let(:resource){ namespace.register(Post) } let :mock_ability_class do Class.new do include CanCan::Ability def initialize(user) can :read, Post cannot :update, Post end end end it "should initialize the ability stored in the namespace configuration" do namespace.authorization_adapter = ActiveAdmin::CanCanAdapter namespace.cancan_ability_class = mock_ability_class auth = namespace.authorization_adapter.new(resource, mock) auth.authorized?(:read, Post).should == true auth.authorized?(:update, Post).should == false end end end
Version data entries
46 entries across 46 versions & 2 rubygems