update factories + tests

This commit is contained in:
Albert Yi
2019-05-10 17:31:07 -07:00
parent 32b4e0a01e
commit 04edc3f533
26 changed files with 81 additions and 83 deletions

View File

@@ -1,7 +1,6 @@
class Comment < ApplicationRecord
include Mentionable
validate :validate_post_exists, :on => :create
validate :validate_creator_is_not_limited, :on => :create
validates_presence_of :body, :message => "has no content"
belongs_to :post

View File

@@ -5,7 +5,7 @@ class Note < ApplicationRecord
belongs_to :post
belongs_to_creator
has_many :versions, -> {order("note_versions.id ASC")}, :class_name => "NoteVersion", :dependent => :destroy
validates_presence_of :post_id, :creator_id, :x, :y, :width, :height, :body
validates_presence_of :creator_id, :x, :y, :width, :height, :body
validate :post_must_exist
validate :note_within_image
after_save :update_post