]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/abilities_test.rb
Update capabilities check to actually reflect the existing logic
[rails.git] / test / models / abilities_test.rb
index 4976b0925e30ef2169f38f4b027dfe72c30b010e..de9f9ba9bab1fe883eb4196c4c7bb8075c264c5a 100644 (file)
@@ -47,6 +47,14 @@ class UserAbilityTest < AbilityTest
 
   test "user preferences" do
     user = create(:user)
+
+    # a user with no tokens
+    ability = Ability.new create(:user), nil
+    [:read, :read_one, :update, :update_one, :delete_one].each do |act|
+      assert ability.can? act, UserPreference
+    end
+
+    # A user with empty tokens
     ability = Ability.new create(:user), tokens
 
     [:read, :read_one, :update, :update_one, :delete_one].each do |act|