spec/generic/spec_helper.rb in cancan-permits-0.2.5 vs spec/generic/spec_helper.rb in cancan-permits-0.2.7
- old
+ new
@@ -10,14 +10,28 @@
def self.available
User.roles
end
end
+class Guest
+ class << self
+ attr_accessor :id_counter
+
+ def next_id
+ @id_counter += 1
+ end
+
+ def create
+ User.new next_id, :guest, 'Guest'
+ end
+ end
+end
+
class User
attr_accessor :id, :role, :name
def self.roles
- [:guest, :admin, :editor]
+ [:guest, :admin, :editor, :super_admin]
end
def initialize id, role, name = nil
self.id = id
raise ArgumentError, "Role #{role} is not in list of available roles: #{self.class.roles}" if !self.class.roles.include? role