Changeset 938

Show
Ignore:
Timestamp:
11/10/07 21:23:32 (1 year ago)
Author:
iv..@gweezlebur.com
Message:

Merki: freeze with merb 0.4.1 pre-release

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • apps/merki/trunk/app/models/page.rb

    r936 r938  
    11class Page < DataMapper::Base 
     2  ## props 
    23  property :title, :string 
     4  property :body, :text 
    35   
    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 
    512end 
    613 
  • apps/merki/trunk/spec/models/page_spec.rb

    r937 r938  
    33module PageSpecHelper 
    44  def valid_page_attributes 
    5     {:title => "My Page" }#, :body => lorem_text, :author_id => 54} 
     5    {:title => "My Page", :body => lorem_text }#, :author_id => 54} 
    66  end 
    77   
     
    5050 
    5151  it "should have a body" do 
    52     pending "Needs implementation" 
    5352    @page.body = lorem_text 
    5453    @page.body.should == lorem_text 
     
    5655   
    5756  it "should require a body" do 
    58     pending "Needs implementation" 
    5957    @page.attributes = valid_page_attributes.except(:body) 
    6058    @page.should_not be_valid 
     
    6260 
    6361  it "should have an author" do 
    64     pending "Needs implementation
     62    pending "decide on versioning
    6563    author = mock("Person") 
    6664    @page.author = author 
     
    6967   
    7068  it "should require a author" do 
    71     pending "Needs implementation
     69    pending "decide on versioning
    7270    @page.attributes = valid_page_attributes.except(:author_id) 
    7371    @page.should_not be_valid 
     
    8583    @page.converted_body.should == textile_text_as_html 
    8684  end 
    87  
     85   
    8886  it "should be valid with all attributes" do 
    89     pending "Needs implementation" 
    9087    @page.attributes = valid_page_attributes 
    9188    @page.should be_valid 
    9289  end 
    9390end 
     91 
     92describe 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 
     107end