From e8e70dfd37ce3da61fdfeb6fc4149b7355e2fb61 Mon Sep 17 00:00:00 2001 From: Ryan Jones Date: Tue, 7 Aug 2012 10:46:13 -0600 Subject: [PATCH] add new files --- app/models/notification_service.rb | 25 +++++++++++++++++++++++++ spec/fabricators/notification_fabricator.rb | 3 +++ spec/models/notification_spec.rb | 5 +++++ 3 files changed, 33 insertions(+), 0 deletions(-) create mode 100644 app/models/notification_service.rb create mode 100644 spec/fabricators/notification_fabricator.rb create mode 100644 spec/models/notification_spec.rb diff --git a/app/models/notification_service.rb b/app/models/notification_service.rb new file mode 100644 index 0000000..beaa886 --- /dev/null +++ b/app/models/notification_service.rb @@ -0,0 +1,25 @@ +class NotificationService + include Mongoid::Document + + field :room_id, :type => String + field :api_token, :type => String + field :subdomain, :type => String + + validate :check_params + + # Subclasses are responsible for overwriting this method. + def check_params; true; end + + def notification_description(problem) + "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" + end + + # Allows us to set the issue tracker class from a single form. + def type; self._type; end + def type=(t); self._type=t; end + + # Retrieve tracker label from either class or instance. + Label = '' + def self.label; self::Label; end + def label; self.class.label; end +end diff --git a/spec/fabricators/notification_fabricator.rb b/spec/fabricators/notification_fabricator.rb new file mode 100644 index 0000000..b855c21 --- /dev/null +++ b/spec/fabricators/notification_fabricator.rb @@ -0,0 +1,3 @@ +Fabricator(:notification) do + name "MyString" +end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb new file mode 100644 index 0000000..2fc117a --- /dev/null +++ b/spec/models/notification_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Notification do + pending "add some examples to (or delete) #{__FILE__}" +end -- libgit2 0.21.2