Sha256: 07bee11169305ac2d2993bbe1401a7dcd199d73b842100a7515b4b33aa00ff4e

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

require File.join(File.dirname(__FILE__), "../spec_helper.rb")

describe Milksteak::Page do

  it "should raise errors if trying to save without a route variable" do
    File.should_not_receive(:new)
    lambda {
      Milksteak::Page.write("test", {}, "content")
    }.should raise_error Milksteak::NoRouteException
  end
  
  it "should save with a route" do
    f = File.new(File.join(File.dirname(__FILE__), "../fixtures/pages/scratch_page.yml"), "w+")
    File.should_receive(:new).with("/tmp/milk_site/pages/home.yml", "w+").and_return f
    page = Milksteak::Page.write("home", 
                              { "description" => "TEST PAGE", "route" => "/test-page"}, 
                              "TEST CONTENT")
    page.data.should == { "description" => "TEST PAGE", "route" => "/test-page" }
    page.content.should == "TEST CONTENT"
    File.unlink(File.join(File.dirname(__FILE__), "../fixtures/pages/scratch_page.yml"))
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
milksteak-0.0.6 spec/models/page_spec.rb
milksteak-0.0.4 spec/models/page_spec.rb