spec/access_rules_spec.rb in tuersteher-0.3.3 vs spec/access_rules_spec.rb in tuersteher-0.3.4
- old
+ new
@@ -68,10 +68,22 @@
it "should not be true for this paths" do
AccessRules.path_access?(@user, '/xyz', :get).should_not be_true
AccessRules.path_access?(@user, '/admin', :post).should_not be_true
end
end
+
+
+ context "without user" do
+ it "should be true for this paths" do
+ AccessRules.path_access?(nil, '/', :get).should be_true
+ end
+
+ it "should not be true for this paths" do
+ AccessRules.path_access?(nil, '/xyz', :get).should_not be_true
+ AccessRules.path_access?(nil, '/admin', :post).should_not be_true
+ end
+ end
end
context 'model_access?' do
@@ -127,10 +139,21 @@
it "should not be true for this" do
AccessRules.model_access?(@user, @model2, :create).should_not be_true
end
end
- end
+
+ context "without user" do
+ it "should be true for this paths" do
+ AccessRules.model_access?(nil, @model1, :xyz).should be_true
+ AccessRules.model_access?(nil, @model2, :read).should be_true
+ end
+
+ it "should not be true for this paths" do
+ AccessRules.model_access?(nil, @model2, :update).should_not be_true
+ end
+ end
+ end # of context 'model_access?'
context 'purge_collection' do