Sha256: b692ca302d320278fdaeef493dfe8ea3ab94dc142e3056a590468f84be1c873a
Contents?: true
Size: 1.31 KB
Versions: 5
Compression:
Stored size: 1.31 KB
Contents
require 'spec_helper' describe ActiveAdmin::AuthorizationAdapter do let(:adapter) { ActiveAdmin::AuthorizationAdapter.new(double, double) } describe "#authorized?" do it "should always return true" do adapter.authorized?(:read, "Resource").should == true end end describe "#scope_collection" do it "should return the collection unscoped" do collection = double adapter.scope_collection(collection, ActiveAdmin::Auth::READ).should == collection end end describe "using #normalized in a subclass" do let(:auth_class) do Class.new(ActiveAdmin::AuthorizationAdapter) do def authorized?(action, subject = nil) case subject when normalized(String) true else false end end end end let(:adapter) { auth_class.new(double, double) } it "should match against a class" do adapter.authorized?(:read, String).should == true end it 'should match against an instance' do adapter.authorized?(:read, "String").should == true end it 'should not match a different class' do adapter.authorized?(:read, Hash).should == false end it 'should not match a different instance' do adapter.authorized?(:read, {}).should == false end end end
Version data entries
5 entries across 5 versions & 1 rubygems