DG MS more test cleanup and removed a deprecation warning
This commit is contained in:
parent
497b477e89
commit
e6f3fc1d38
4 changed files with 7 additions and 28 deletions
|
|
@ -1,21 +1,14 @@
|
|||
class Blog
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include ROXML
|
||||
class Blog < Post
|
||||
|
||||
xml_accessor :title
|
||||
xml_accessor :body
|
||||
xml_accessor :owner
|
||||
|
||||
|
||||
field :title
|
||||
field :body
|
||||
field :owner
|
||||
|
||||
validates_presence_of :title, :body
|
||||
|
||||
before_create :set_default_owner
|
||||
|
||||
def self.newest(owner_email)
|
||||
Blog.last(:conditions => {:owner => owner_email})
|
||||
end
|
||||
|
|
@ -23,10 +16,4 @@ class Blog
|
|||
def self.my_newest
|
||||
Blog.newest(User.first.email)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_default_owner
|
||||
self.owner ||= User.first.email
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,20 +1,12 @@
|
|||
class Bookmark
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
class Bookmark < Post
|
||||
|
||||
xml_accessor :link
|
||||
xml_accessor :title
|
||||
|
||||
field :owner
|
||||
field :link
|
||||
field :title
|
||||
|
||||
|
||||
validates_presence_of :link
|
||||
|
||||
before_create :set_default_owner
|
||||
|
||||
protected
|
||||
|
||||
def set_default_owner
|
||||
self.owner ||= User.first.email
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
- form_for @blog do |f|
|
||||
= form_for @blog do |f|
|
||||
= f.error_messages
|
||||
%p
|
||||
= f.label :title
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe Post do
|
||||
before(:all) do
|
||||
before do
|
||||
Factory.create(:user, :email => "bob@aol.com")
|
||||
@post = Factory.create(:post, :owner => nil, :source => nil, :snippet => nil)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue