ruby - What is the best practice for testing Models in Rails? -
how or how little should 1 test models in rails? since framework doing you, i'm wondering if it's worth testing generated activerecord methods make sure work or not.
do guys test them implicitly through controllers?
in java world, if used hibernate, had write orm mapping stuff testing save/delete/find each entity important - if inherited these methods base class - because possible mapping information wrong, or make silly mistake. deletes important test make sure hibernate cascade properly.
but since don't configure of stuff in rails @ all... it's simple... worth testing, or assume works? limit maybe making sure associations work expected?
what best practice? testing examples? found page here: http://guides.rubyonrails.org/testing.html
but didn't talk activerecord. focused more on controllers , other things.
thanks!
i don't try test methods introduced active record , such. tested rails team. , have written test cases.
but test methods , custom code write in models. first test them individual units use unit tests. , make sure whole thing works (models controllers..etc) can use integration tests.
the railsguides starting point you. afterwards can digg in more interesting stuff. recommend take , rspec , cucumber.
some more stackoverflow questions (and answers) helpful you
Comments
Post a Comment