require "test_helper"

class PostCategoryTest < ActiveSupport::TestCase
  test "should create a PostCategory" do
    post_category_1 = PostCategory.new
    assert_equal false, post_category_1.save

    post_category = PostCategory.new(name: "Category One", url_slug: "cat-1")
    assert_equal true, post_category.save
  end

  test "should set category to a post" do
    category_1 = post_categories(:cat_one)
    post = Post.new
    post.post_category = category_1
    assert_equal category_1.id, post.post_category_id
    assert_equal "CategoryOne", post.post_category.name
  end
end
