Sha256: 6d03a2b5451172266287ad69cfa7061205082a5063e85bf62d20d87ce2146283
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
require File.dirname(__FILE__) + '/../helpers' require 'bloggit' class PostTest < Test::Unit::TestCase should "raise an error if trying to load a `Post` from a non-existant file" do assert_raise(RuntimeError) { Bloggit::Post.from_file 'crapfile.post' } end should "parse `Post` from file" do assert_nothing_raised(RuntimeError) do post = Bloggit::Post.from_file File.join(File.dirname(__FILE__), '../fixtures/test.blog/posts/2004.03.07_to-boldly-go.post') assert_not_nil post assert_equal 'to-boldly-go', post.slug assert_equal 2004, post.post_year end end should "parse publish date and slug" do assert_nothing_raised(RuntimeError) do post = Bloggit::Post.from_file File.join(File.dirname(__FILE__), '../fixtures/test.blog/posts/2004.03.07_to-boldly-go.post') assert_not_nil post assert_equal 'to-boldly-go', post.slug assert_equal 2004, post.post_year assert_equal Date, post.publish_date.class post = Bloggit::Post.from_file File.join(File.dirname(__FILE__), '../fixtures/test.blog/posts/2007.03.25_sure-whatever.post') assert_not_nil post assert_equal 'sure-whatever', post.slug assert_equal 2007, post.post_year assert_equal Date, post.publish_date.class end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bloggit-1.0.7 | test/unit/post_test.rb |
bloggit-1.0.3 | test/unit/post_test.rb |