ruby on rails - Writing Testcase in Rspec for Update method -


i writing rspec update method of controller updates record in table t given id id. here in spec want add case checks whether record id exists in table t, , if not exist, should give error following being new rspec not complete it.

  "should give error when record given id not exist"     pending "case yet handled"   end 

so if helps me in writing spec.

you should pass parameter id , use correct http verb send request update action. i.e

it "should give error when record given id not exist"     put :update, id: <invalid_id>     # expectations here     end 

how learned test rails applications, part 4: controller spe has example , more explanation on controller tests.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -