Changeset 938
- Timestamp:
- 11/10/07 21:23:32 (1 year ago)
- Files:
-
- apps/merki/trunk/app/models/page.rb (modified) (1 diff)
- apps/merki/trunk/spec/models/page_spec.rb (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
apps/merki/trunk/app/models/page.rb
r936 r938 1 1 class Page < DataMapper::Base 2 ## props 2 3 property :title, :string 4 property :body, :text 3 5 4 validates_presence_of :title 6 ## relationships 7 ## TODO: come back to this when we figure out versioning 8 # belongs_to :author, :class => 'User' 9 10 ## validations 11 validates_presence_of :title, :body 5 12 end 6 13 apps/merki/trunk/spec/models/page_spec.rb
r937 r938 3 3 module PageSpecHelper 4 4 def valid_page_attributes 5 {:title => "My Page" }#, :body => lorem_text, :author_id => 54}5 {:title => "My Page", :body => lorem_text }#, :author_id => 54} 6 6 end 7 7 … … 50 50 51 51 it "should have a body" do 52 pending "Needs implementation"53 52 @page.body = lorem_text 54 53 @page.body.should == lorem_text … … 56 55 57 56 it "should require a body" do 58 pending "Needs implementation"59 57 @page.attributes = valid_page_attributes.except(:body) 60 58 @page.should_not be_valid … … 62 60 63 61 it "should have an author" do 64 pending " Needs implementation"62 pending "decide on versioning" 65 63 author = mock("Person") 66 64 @page.author = author … … 69 67 70 68 it "should require a author" do 71 pending " Needs implementation"69 pending "decide on versioning" 72 70 @page.attributes = valid_page_attributes.except(:author_id) 73 71 @page.should_not be_valid … … 85 83 @page.converted_body.should == textile_text_as_html 86 84 end 87 85 88 86 it "should be valid with all attributes" do 89 pending "Needs implementation"90 87 @page.attributes = valid_page_attributes 91 88 @page.should be_valid 92 89 end 93 90 end 91 92 describe Page, "class" do 93 it "should have a class level base_url" do 94 pending "Needs implementation" 95 Page.base_url = "http://merbivore.com/wiki/" 96 Page.base_url.should == "http://merbivore.com/wiki/" 97 end 98 99 it "should be able to find Pages by URL slug" do 100 pending "Needs implementation" 101 page = mock("Page") 102 Page.should_receive(:find_by_title).with("Sample Page").once. 103 and_return(page) 104 # Page. 105 106 end 107 end
