spec/guard_export_spec.rb in ixtlan-guard-0.6.1 vs spec/guard_export_spec.rb in ixtlan-guard-0.7.0

- old
+ new

@@ -16,10 +16,11 @@ it 'should deny all without defaults but wildcard "*" actions' do subject.permissions(['unknown_group']).should == [ #allow nothing {:permission=>{:resource=>"users", :actions=>[], :deny=>false}}, + {:permission=>{:resource=>"only_defaults", :actions=>[], :deny=>true}}, {:permission=> { :resource=>"no_defaults", :actions=>[{:action=>{:name=>"index"}}], :deny=>false #allow @@ -34,16 +35,19 @@ } }, #allow nothing {:permission=>{:resource=>"person", :actions=>[], :deny=>false}}, #allow nothing - {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}] + {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}, + # allow anything but index + {:permission=>{:resource=>"allow_all_defaults", :actions=>[{:action=>{:name=>"index"}}], :deny=>true}}] end it 'should deny some without defaults but wildcard "*" actions' do subject.permissions(['no_admin']).should == [ #allow nothing {:permission=>{:resource=>"users", :actions=>[], :deny=>false}}, + {:permission=>{:resource=>"only_defaults", :actions=>[], :deny=>true}}, {:permission=> { :resource=>"no_defaults", :actions=> [{:action=>{:name=>"edit"}}, @@ -61,24 +65,29 @@ } }, #allow nothing {:permission=>{:resource=>"person", :actions=>[], :deny=>false}}, #allow nothing - {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}] + {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}, + # allow anything but index + {:permission=>{:resource=>"allow_all_defaults", :actions=>[{:action=>{:name=>"index"}}], :deny=>true}}] end it 'should allow "root"' do subject.permissions(['root']).should == [ {:permission=>{:resource=>"users", :actions=>[], :deny=>true}}, + {:permission=>{:resource=>"only_defaults", :actions=>[], :deny=>true}}, {:permission=>{:resource=>"no_defaults", :actions=>[], :deny=>true}}, {:permission=>{:resource=>"defaults", :actions=>[], :deny=>true}}, {:permission=>{:resource=>"person", :actions=>[], :deny=>true}}, - {:permission=>{:resource=>"accounts", :actions=>[], :deny=>true}}] + {:permission=>{:resource=>"accounts", :actions=>[], :deny=>true}}, + {:permission=>{:resource=>"allow_all_defaults", :actions=>[], :deny=>true}}] end it 'should allow with default group' do subject.permissions(['_master']).should == [ #allow nothing {:permission=>{:resource=>"users", :actions=>[], :deny=>false}}, + {:permission=>{:resource=>"only_defaults", :actions=>[], :deny=>true}}, {:permission=> { :resource=>"no_defaults", :actions=>[{:action=>{:name=>"index"}}], :deny=>false #allow @@ -94,16 +103,19 @@ } }, #allow nothing {:permission=>{:resource=>"person", :actions=>[], :deny=>false}}, #allow nothing - {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}] + {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}, + # allow anything but index + {:permission=>{:resource=>"allow_all_defaults", :actions=>[{:action=>{:name=>"index"}}], :deny=>true}}] end it 'should allow with non-default group' do subject.permissions(['_admin']).should == [ #allow nothing {:permission=>{:resource=>"users", :actions=>[], :deny=>false}}, + {:permission=>{:resource=>"only_defaults", :actions=>[], :deny=>true}}, {:permission=> { :resource=>"no_defaults", :actions=>[{:action=>{:name=>"index"}}], :deny=>false #allow @@ -120,10 +132,12 @@ } }, #allow nothing {:permission=>{:resource=>"person", :actions=>[], :deny=>false}}, #allow nothing - {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}] + {:permission=>{:resource=>"accounts", :actions=>[], :deny=>false}}, + # allow anything but index + {:permission=>{:resource=>"allow_all_defaults", :actions=>[], :deny=>true}}] end end context '#permission_map' do it 'should export' do