From 10614fd50018937e83828327961954001347244b Mon Sep 17 00:00:00 2001 From: Mark Holton Date: Sun, 15 Feb 2009 16:30:38 -0800 Subject: [PATCH] improved a couple users tests --- db/test.sqlite3 | Bin 13312 -> 13312 bytes test/functional/users_controller_test.rb | 28 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/db/test.sqlite3 b/db/test.sqlite3 index 550b79de1fe603857b669b594a7c3721e304675b..9eeff56d0bddec40762dcbc973635f8d9c88903d 100644 GIT binary patch delta 212 zcmZq3Xvo;Gm|eoyz{<$j$iTo-*T6{E&`iO=zzQrhc{jT*PRUIiy?Ask<#)!dQ=otu Yr{v@g;W(U input#user_password").size assert_select "div.fieldWithErrors > input#user_password", :text => "" + assert_select "div#errorExplanation > ul > li", :text => "Password doesn't match confirmation" + assert_select "div#errorExplanation > ul > li", :text => "Password Missing password" + assert_select "div#errorExplanation > ul > li", :count => 2 end + test "should not create user and show red boxes when password does not match password confirm" do + assert_no_difference('User.count') do + post :create, :user => { + :name => 'asdfasdfasdf', + :password => 'onetwotree', + :password_confirmation => 'onetwo', + } + end + + assert_response :ok + assert_tag :tag => "div", :attributes => { :id => "errorExplanation" } + assert_tag :tag => "div", :attributes => { :class => "fieldWithErrors"} + assert_select "div[class*=fieldWithErrors]", :count => 1 + assert_select "div[class*=errorExplanation]", :count => 1 + # check explicitly that both the input is blank for Title and it is a fieldWithErrors + assert_select "div.fieldWithErrors" do + assert_select "input:last-of-type", "" + end + # check explicitly that both the input#product_price errs out and is blank + assert_equal 1, css_select("div.fieldWithErrors > input#user_password").size + assert_select "div.fieldWithErrors > input#user_password", :text => "" + assert_select "div#errorExplanation > ul > li", :text => "Password doesn't match confirmation" + end + + test "should show user" do get :show, :id => users(:one).id assert_response :success