| |   |
| 9 | 9 | # |
| 10 | 10 | # It's strongly recommended to check this file into your version control system. |
| 11 | 11 | |
| 12 | | ActiveRecord::Schema.define(:version => 6) do |
| 12 | ActiveRecord::Schema.define(:version => 7) do |
| 13 | |
| 14 | create_table "authors", :force => true do |t| |
| 15 | t.string "name" |
| 16 | t.string "email" |
| 17 | t.string "open_id" |
| 18 | end |
| 13 | 19 | |
| 14 | 20 | create_table "comments", :force => true do |t| |
| 15 | 21 | t.integer "post_id", :null => false |
| … | … | |
| 23 | 23 | t.string "author_url", :default => "", :null => false |
| 24 | 24 | t.string "author_email", :default => "", :null => false |
| 25 | 25 | t.string "author_openid_authority", :default => "", :null => false |
| 26 | | t.text "body", :default => "", :null => false |
| 27 | | t.text "body_html", :default => "", :null => false |
| 26 | t.text "body", :null => false |
| 27 | t.text "body_html", :null => false |
| 28 | 28 | t.datetime "created_at" |
| 29 | 29 | t.datetime "updated_at" |
| 30 | 30 | end |
| … | … | |
| 35 | 35 | create_table "pages", :force => true do |t| |
| 36 | 36 | t.string "title", :default => "", :null => false |
| 37 | 37 | t.string "slug", :default => "", :null => false |
| 38 | | t.text "body", :default => "", :null => false |
| 39 | | t.text "body_html", :default => "", :null => false |
| 38 | t.text "body", :null => false |
| 39 | t.text "body_html", :null => false |
| 40 | 40 | t.datetime "created_at" |
| 41 | 41 | t.datetime "updated_at" |
| 42 | 42 | end |
| … | … | |
| 47 | 47 | create_table "posts", :force => true do |t| |
| 48 | 48 | t.string "title", :default => "", :null => false |
| 49 | 49 | t.string "slug", :default => "", :null => false |
| 50 | | t.text "body", :default => "", :null => false |
| 51 | | t.text "body_html", :default => "", :null => false |
| 50 | t.text "body", :null => false |
| 51 | t.text "body_html", :null => false |
| 52 | 52 | t.boolean "active", :default => true, :null => false |
| 53 | 53 | t.integer "approved_comments_count", :default => 0, :null => false |
| 54 | 54 | t.string "cached_tag_list" |
| toggle raw diff |
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -9,7 +9,13 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 6) do
+ActiveRecord::Schema.define(:version => 7) do
+
+ create_table "authors", :force => true do |t|
+ t.string "name"
+ t.string "email"
+ t.string "open_id"
+ end
create_table "comments", :force => true do |t|
t.integer "post_id", :null => false
@@ -17,8 +23,8 @@ ActiveRecord::Schema.define(:version => 6) do
t.string "author_url", :default => "", :null => false
t.string "author_email", :default => "", :null => false
t.string "author_openid_authority", :default => "", :null => false
- t.text "body", :default => "", :null => false
- t.text "body_html", :default => "", :null => false
+ t.text "body", :null => false
+ t.text "body_html", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -29,8 +35,8 @@ ActiveRecord::Schema.define(:version => 6) do
create_table "pages", :force => true do |t|
t.string "title", :default => "", :null => false
t.string "slug", :default => "", :null => false
- t.text "body", :default => "", :null => false
- t.text "body_html", :default => "", :null => false
+ t.text "body", :null => false
+ t.text "body_html", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -41,8 +47,8 @@ ActiveRecord::Schema.define(:version => 6) do
create_table "posts", :force => true do |t|
t.string "title", :default => "", :null => false
t.string "slug", :default => "", :null => false
- t.text "body", :default => "", :null => false
- t.text "body_html", :default => "", :null => false
+ t.text "body", :null => false
+ t.text "body_html", :null => false
t.boolean "active", :default => true, :null => false
t.integer "approved_comments_count", :default => 0, :null => false
t.string "cached_tag_list" |
| |   |
| 1 | require File.dirname(__FILE__) + '/../spec_helper' |
| 2 | |
| 3 | describe Author, 'validations' do |
| 4 | def valid_author_attributes |
| 5 | { |
| 6 | :name => "Don Alias", |
| 7 | :email => "don@enkiblog.com", |
| 8 | :open_id => "http://enkiblog.com" |
| 9 | } |
| 10 | end |
| 11 | |
| 12 | it 'is valid with valid_author_attributes' do |
| 13 | Author.new(valid_author_attributes).should be_valid |
| 14 | end |
| 15 | |
| 16 | it 'is invalid with no name' do |
| 17 | Author.new(valid_author_attributes.merge(:name => '')).should_not be_valid |
| 18 | end |
| 19 | |
| 20 | it 'is invalid with no email' do |
| 21 | Author.new(valid_author_attributes.merge(:email => '')).should_not be_valid |
| 22 | end |
| 23 | |
| 24 | it 'is invalid with no open_id' do |
| 25 | Author.new(valid_author_attributes.merge(:open_id => '')).should_not be_valid |
| 26 | end |
| 27 | end |
| toggle raw diff |
--- /dev/null
+++ b/spec/models/authors_spec.rb
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe Author, 'validations' do
+ def valid_author_attributes
+ {
+ :name => "Don Alias",
+ :email => "don@enkiblog.com",
+ :open_id => "http://enkiblog.com"
+ }
+ end
+
+ it 'is valid with valid_author_attributes' do
+ Author.new(valid_author_attributes).should be_valid
+ end
+
+ it 'is invalid with no name' do
+ Author.new(valid_author_attributes.merge(:name => '')).should_not be_valid
+ end
+
+ it 'is invalid with no email' do
+ Author.new(valid_author_attributes.merge(:email => '')).should_not be_valid
+ end
+
+ it 'is invalid with no open_id' do
+ Author.new(valid_author_attributes.merge(:open_id => '')).should_not be_valid
+ end
+end |