Created
February 25, 2017 18:24
-
-
Save katatsu12/06288b5468d96b062fcf19400736d411 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 "rails_helper" | |
RSpec.describe Article, :type => :model do | |
it "Validation Error title" do | |
article = Article.new(title: '') | |
article.valid? | |
article.errors[:title] | |
end | |
it "Validation Error lenghr" do | |
article = Article.new(title: 'as') | |
article.valid? | |
article.errors[:title] | |
end | |
it "is valid with valid attributes" do | |
expect(Article.new(title: 'Anything')).to be_valid | |
end | |
it "Article has many a comments" do | |
comment = Comment.new | |
article = Article.new | |
article.comments << comment | |
expect(comment.article).to be article | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment