Sha256: a7f5589029c20dd698c7da70eca44600ca4c175189bfe76199922e1d0c628907
Contents?: true
Size: 1.14 KB
Versions: 36
Compression:
Stored size: 1.14 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../simple_spec_helper') describe Lolita::Extensions::Authorization::DefaultAdapter do let(:klass){ Lolita::Extensions::Authorization::DefaultAdapter } let(:adapter){ klass.new(Object.new,{}) } it "should create new" do expect do klass.new(Object.new,{}) end.not_to raise_error end context "current user" do it "can do all" do adapter.can?(:read,Object.new).should be_true end it "cannot do nothing" do adapter.cannot?([]).should be_false end it "should not have current ability" do adapter.current_ability.should be_nil end it "should be authorized for all" do expect do adapter.authorize! end.not_to raise_error end end describe 'Integration with proxy' do let(:proxy){ Lolita::Extensions::Authorization::Proxy.new(Object.new,{}) } it "should have the same method results for adapter and proxy" do proxy.adapter = adapter %w(can? cannot? current_ability authorize!).each do |name| proxy.send(name).should eql(adapter.send(name)) end end end end
Version data entries
36 entries across 36 versions & 1 rubygems