public
Description: Symbiot's open source documentation system
Clone URL: git://github.com/mando/chronicle.git
Search Repo:
Added in initial specs and modifications to page model to get the specs 
passing.
mando (author)
Tue May 13 11:32:31 -0700 2008
commit  d868a2639694a434de36774792092ba08e03bc3e
tree    0dc370cbb60643a475a807b5f68ec3d861548b1c
parent  c67bca48db08354ceffab9453dcc278f0219b919
...
2
3
4
 
 
 
5
6
7
...
2
3
4
5
6
7
8
9
10
0
@@ -2,6 +2,9 @@ class Page < ActiveRecord::Base
0
   has_many :taggings, :dependent => :destroy
0
   has_many :tags, :through => :taggings, :uniq => true
0
 
0
+ validates_presence_of :title, :message => 'is required'
0
+ validates_presence_of :body, :message => 'is required'
0
+
0
   def tag_list
0
     self.tags.map{|t| t.name}.join(", ")
0
   end
...
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
0
@@ -0,0 +1,7 @@
0
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
0
+
0
+# one:
0
+# column: value
0
+#
0
+# two:
0
+# column: value
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
0
@@ -0,0 +1,31 @@
0
+require File.dirname(__FILE__) + '/../spec_helper'
0
+
0
+describe Page do
0
+ include PageSpecHelper
0
+
0
+ before(:each) do
0
+ @page = Page.new
0
+ end
0
+
0
+ it "should be invalid without a title" do
0
+ @page.attributes = valid_page_attributes.except(:title)
0
+ @page.should_not be_valid
0
+ @page.errors.on(:title).should eql("is required")
0
+ @page.title = 'My Title'
0
+ @page.should be_valid
0
+ end
0
+
0
+ it "should be invalid without a body" do
0
+ @page.attributes = valid_page_attributes.except(:body)
0
+ @page.should_not be_valid
0
+ @page.errors.on(:body).should eql("is required")
0
+ @page.body = 'My Body'
0
+ @page.should be_valid
0
+ end
0
+
0
+ it "should be valid with a full set of valid attributes" do
0
+ @page.attributes = valid_page_attributes
0
+ @page.should be_valid
0
+ end
0
+
0
+end
...
37
38
39
 
 
 
 
 
 
 
 
 
...
37
38
39
40
41
42
43
44
45
46
47
48
0
@@ -37,3 +37,12 @@ Spec::Runner.configure do |config|
0
   # config.mock_with :flexmock
0
   # config.mock_with :rr
0
 end
0
+
0
+module PageSpecHelper
0
+ def valid_page_attributes
0
+ {
0
+ :body => 'My Body',
0
+ :title => 'My Title'
0
+ }
0
+ end
0
+end

Comments

    No one has commented yet.