1 require File.dirname(__FILE__) + '/../helpers'
4 class SiteTest < Test::Unit::TestCase
6 should "not allow `Site.new`" do
7 assert_raise(NoMethodError) { Bloggit::Site.new }
10 should "not create a `Site` object unless path is a directory" do
11 assert_raise(RuntimeError) { Bloggit::Site.from_file(__FILE__) }
14 should "create a `Site` object from a file path" do
15 site = Bloggit::Site.from_file(File.join(File.dirname(__FILE__), '../fixtures/test.blog') )
17 assert site.is_a?( Bloggit::Site )
18 assert_equal 3, site.posts.length
19 assert_equal Time, site.posts[0].publish_date.class
20 assert_not_nil site.settings
21 assert_equal 'My Site', site.settings['site']['title']
22 # Test Hash extenstion too..
23 assert_equal 'My Site', site.settings.site.title
24 assert_equal 'My Site', site.title