Sha256: 79782f0681329d8eb0a01fb3609a92c3d7ab177256c1b0ec151a18ccbdaacca8

Contents?: true

Size: 1008 Bytes

Versions: 17

Compression:

Stored size: 1008 Bytes

Contents

# == Schema Information
#
# Table name: proclaim_comments
#
#  id         :integer          not null, primary key
#  post_id    :integer
#  parent_id  :integer
#  author     :string
#  body       :text
#  created_at :datetime         not null
#  updated_at :datetime         not null
#

require 'test_helper'

module Proclaim
	class CommentTest < ActiveSupport::TestCase
		test "ensure factory is good" do
			comment = FactoryGirl.build(:comment)

			assert comment.save, "Factory needs to be updated to save successfully"
		end

		test "ensure body is required" do
			comment = FactoryGirl.build(:comment, body: "")

			refute comment.save, "Comment should require a body!"
		end

		test "ensure post is required" do
			comment = FactoryGirl.build(:comment, post_id: nil)

			refute comment.save, "Comment should require a post_id!"

			# Post with 12345 shouldn't exist
			comment = FactoryGirl.build(:comment, post_id: 12345)

			refute comment.save, "Comment should require a valid post!"
		end
	end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
proclaim-0.5.6 test/models/proclaim/comment_test.rb
proclaim-0.5.5 test/models/proclaim/comment_test.rb
proclaim-0.5.3 test/models/proclaim/comment_test.rb
proclaim-0.5.2 test/models/proclaim/comment_test.rb
proclaim-0.5.1 test/models/proclaim/comment_test.rb
proclaim-0.5.0 test/models/proclaim/comment_test.rb
proclaim-0.4.0 test/models/proclaim/comment_test.rb
proclaim-0.3.1 test/models/proclaim/comment_test.rb
proclaim-0.3.0 test/models/proclaim/comment_test.rb
proclaim-0.2.4 test/models/proclaim/comment_test.rb
proclaim-0.2.2 test/models/proclaim/comment_test.rb
proclaim-0.2.1 test/models/proclaim/comment_test.rb
proclaim-0.2.0 test/models/proclaim/comment_test.rb
proclaim-0.1.3 test/models/proclaim/comment_test.rb
proclaim-0.1.2 test/models/proclaim/comment_test.rb
proclaim-0.1.1 test/models/proclaim/comment_test.rb
proclaim-0.1.0 test/models/proclaim/comment_test.rb