1 require File.dirname(__FILE__) + '/../helpers'
4 class PageTest < Test::Unit::TestCase
6 should "raise an error if trying to load a `Page` from a non-existant file" do
7 assert_raise(RuntimeError) { Bloggit::Page.from_file 'crapfile.page' }
10 should "parse `Page` from file" do
11 assert_nothing_raised(RuntimeError) do
12 page = Bloggit::Page.from_file File.join(File.dirname(__FILE__), '../fixtures/test.blog/pages/about.page')
14 assert_equal 'about', page.slug
18 should "parse status and slug" do
19 assert_nothing_raised(RuntimeError) do
20 page = Bloggit::Page.from_file File.join(File.dirname(__FILE__), '../fixtures/test.blog/pages/about.page')
22 assert_equal 'About', page.title
23 assert_equal 'about', page.slug
24 assert_equal 'publish', page.status
28 should "allowing finding pages by tag" do
29 site = Bloggit::Site.from_file(File.join(File.dirname(__FILE__), '../fixtures/test.blog') )
30 pages = Page.find_by_tag 'todo'
32 assert_equal 1, pages.length
33 assert_equal "To Do", pages[0].title