spec/apps/kitchen_sink/app/main/models/user.rb in volt-0.9.5 vs spec/apps/kitchen_sink/app/main/models/user.rb in volt-0.9.6.pre1
- old
+ new
@@ -4,6 +4,24 @@
field login_field
field :name
validate login_field, unique: true, length: 8
validate :email, email: true
+
+ unless RUBY_PLATFORM == "opal"
+ Volt.current_app.on("user_connect") do |user_id|
+ begin
+ Volt.current_app.store.users.where(id: user_id).first.sync._event_triggered = "user_connect"
+ rescue
+ #we rescue as this callback will also get called from the SocketConnectionHandler specs (and will fail)
+ end
+ end
+
+ Volt.current_app.on("user_disconnect") do |user_id|
+ begin
+ Volt.current_app.store.users.where(id: user_id).first.sync._event_triggered = "user_disconnect"
+ rescue
+ #we rescue as this callback will also get called from the SocketConnectionHandler specs (and will fail)
+ end
+ end
+ end
end