require "test_helper"

class PostTest < ActiveSupport::TestCase
  test "published? method should work" do
    post = posts(:one)
    assert_equal true, post.is_draft?
    assert_equal false, post.published?
  end

  test "hit_count should work" do
    post = posts(:one)
    hit_count_ori = post.hit_count
    updated_at_ori = post.updated_at
    post.increment!(:hit_count)
    post.reload
    assert_equal (hit_count_ori + 1), post.hit_count
    assert_equal updated_at_ori, post.updated_at
  end
end
