Last active
June 28, 2022 03:55
-
-
Save itsmeurbi/bd0584da3745d111d21a6658673e4351 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class PostTest < ActiveSupport::TestCase | |
test 'it is not valid without title' do | |
post = Post.new | |
refute post.valid? | |
assert_equal ["can't be blank"], post.errors.messages[:title] | |
end | |
test 'it is not valid without content' do | |
post = Post.new | |
refute post.valid? | |
assert_equal ["can't be blank"], post.errors.messages[:content] | |
end | |
test 'it is valid with title and content' do | |
post = Post.new(title: 'My post', content: 'My new blog post') | |
assert post.valid? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment