Sha256: a97a81504096c6ddf2f2a1e278071db6e6d4ff5f359b3a56fc30f33958bf4f8c
Contents?: true
Size: 1.38 KB
Versions: 20
Compression:
Stored size: 1.38 KB
Contents
require "spec_helper" describe PostWithCommentValidationsForm do it "1. 'PostWithCommentValidationsForm' becomes invalid if 'Post' or nested 'Comment's has errors after the #submit method and incorporates its errors." do params = { post: { title: 'First post', body: 'post body', comments_attributes: { "0" => { body: "body1" } } } } post_form = PostWithCommentValidationsForm.new(params[:post]) post_form.valid?.should == true post_form.save post_form.should have(1).error_on(:title) post_form.should have(1).error_on(:comments) post_form.errors.size.should == 2 post_form.comments.first.should have(1).error_on(:body) post_form.valid?.should == false post_form.should have(1).error_on(:title) post_form.should have(1).error_on(:comments) post_form.errors.size.should == 2 post_form.comments.first.should have(1).error_on(:body) post_form.save post_form.should have(1).error_on(:title) post_form.should have(1).error_on(:comments) post_form.errors.size.should == 2 post_form.comments.first.should have(1).error_on(:body) post_form.valid?.should == false post_form.should have(1).error_on(:title) post_form.should have(1).error_on(:comments) post_form.errors.size.should == 2 post_form.comments.first.should have(1).error_on(:body) end end
Version data entries
20 entries across 20 versions & 1 rubygems