Sha256: 08c412b1805926f50b24936ff34780e6ab837ec39f7ab9df087d48f5ed4f32b1
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
require File.expand_path('../test_helper', File.dirname(__FILE__)) class SofaBlog::PostTest < ActiveSupport::TestCase def test_fixtures_validity SofaBlog::Post.all.each do |post| assert post.valid?, post.errors.full_messages.to_s end end def test_validations post = SofaBlog::Post.new assert post.invalid? assert_has_errors_on post, [:title, :content] end def test_creation assert_difference 'SofaBlog::Post.count' do SofaBlog::Post.create!( :title => 'Test Post', :content => 'Test Content' ) end end def test_destroy assert_difference ['SofaBlog::Post.count', 'SofaBlog::Comment.count'], -1 do sofa_blog_posts(:default).destroy end end def test_to_param post = sofa_blog_posts(:default) assert_equal "#{post.id}-default-title", post.to_param end def test_scope_published post = sofa_blog_posts(:default) assert post.is_published? assert_equal 1, SofaBlog::Post.published.count assert_equal post, SofaBlog::Post.published.first end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sofa_blog-0.1.3 | test/unit/post_test.rb |
sofa_blog-0.1.2 | test/unit/post_test.rb |
sofa_blog-0.1.1 | test/unit/post_test.rb |
sofa_blog-0.1.0 | test/unit/post_test.rb |