spec/rails_app/app/models/admin.rb in activity_notification-1.3.0 vs spec/rails_app/app/models/admin.rb in activity_notification-1.4.0

- old
+ new

@@ -1,9 +1,30 @@ -class Admin < ActiveRecord::Base - belongs_to :user - validates :user, presence: true +if ENV['AN_TEST_DB'] != 'mongodb' + class Admin < ActiveRecord::Base + belongs_to :user + validates :user, presence: true - acts_as_notification_target email_allowed: false, - subscription_allowed: true, - devise_resource: :user, - printable_name: ->(admin) { "admin (#{admin.user.name})" } + acts_as_notification_target email_allowed: false, + subscription_allowed: true, + devise_resource: :user, + printable_name: ->(admin) { "admin (#{admin.user.name})" } + end +else + require 'mongoid' + class Admin + include Mongoid::Document + include Mongoid::Timestamps + include GlobalID::Identification + + belongs_to :user + validates :user, presence: true + + field :phone_number, type: String + field :slack_username, type: String + + include ActivityNotification::Models + acts_as_notification_target email_allowed: false, + subscription_allowed: true, + devise_resource: :user, + printable_name: ->(admin) { "admin (#{admin.user.name})" } + end end