Created
February 25, 2017 10:53
-
-
Save katatsu12/09de967eca67a29795902c12a84faa47 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 "validates title" do | |
article = Article.new(title: '') | |
article.valid? | |
article.errors[:title] | |
end | |
it "validates lenghr" do | |
article = Article.new(title: 'as') | |
article.valid? | |
article.errors[:title] | |
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