Sha256: dc6de6e3f6dd8b6ab1890939c4f475726103bc41554963d2ed86e2988d0e6696
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
require 'test_helper' class PostTest < ActiveSupport::TestCase def setup @post = create_post end test "should start unpublished" do assert @post.unpublished? assert !@post.published? end test "should publish" do @post.publish assert @post.published? assert !@post.unpublished? end test "should unpublish" do @post.publish @post.unpublish assert @post.unpublished? end test "should define published scope" do @published = create_post(:title => 'Title') @published.publish! @unpublished = create_post assert Post.published.include?(@published) assert !Post.published.include?(@unpublished) end test "should define the unpublished scope" do @published = create_post(:title => 'Title') @published.publish! @unpublished = create_post assert Post.unpublished.include?(@unpublished) assert !Post.unpublished.include?(@published) end test "should require name before publishing" do @post.publish assert !@post.valid? end end
Version data entries
6 entries across 6 versions & 1 rubygems