Sha256: 07259c21bdef44464d8a6573d84bb20de79e51f35b5d45f91ca523314256c09b
Contents?: true
Size: 1.33 KB
Versions: 20
Compression:
Stored size: 1.33 KB
Contents
require "spec_helper" describe PostValidationsForm do it "1. 'PostValidationsForm' becomes invalid if 'Post' 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 = PostValidationsForm.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