test/unit/post_test.rb in comfy_blog-0.1.7 vs test/unit/post_test.rb in comfy_blog-0.1.8
- old
+ new
@@ -14,16 +14,16 @@
assert_has_errors_on post, [:title, :slug, :content]
end
def test_validation_of_slug_uniqueness
old_post = blog_posts(:default)
- old_post.update_attributes!(:year => Time.now.year, :month => Time.now.month)
+ old_post.update_attributes!(:published_at => Time.now)
post = Blog::Post.new(:title => old_post.title, :content => 'Test Content')
assert post.invalid?
assert_has_errors_on post, [:slug]
- old_post.update_attributes!(:year => 1.year.ago.year, :month => Time.now.month)
+ old_post.update_attributes!(:published_at => 1.year.ago)
assert post.valid?
end
def test_creation
assert_difference 'Blog::Post.count' do
@@ -43,12 +43,13 @@
assert_equal 'test-title', post.slug
end
def test_set_date
post = Blog::Post.new
+ post.send(:set_published_at)
post.send(:set_date)
- assert_equal Time.now.year, post.year
- assert_equal Time.now.month, post.month
+ assert_equal post.published_at.year, post.year
+ assert_equal post.published_at.month, post.month
end
def test_set_published_at
post = Blog::Post.new
post.send(:set_published_at)