Why no controller specs for "Votes" model in Rails Best Practices source
Posted by Nitish on April 14, 2013
I am reading source of Rails Best Practices website ( https://github.com/railsbp/rails-bestpractices.com ) to peek into some quality real world code which is also not too intimidating for beginners.
I am particularly interested in testing strategies used.I noticed that for testing creation of votes, the test suite had this code as part of model spec.
describe 'when created' do
it "should increment corresponding Post#vote_points if indicated as
orig_vote_point = post.vote_points FactoryGirl.create(:vote, :voteable => post, :like => true) post.reload post.vote_points.should == orig_vote_point + 1 end it "should decrement corresponding Post#vote_points if indicated as 'don
orig_vote_point = post.vote_points FactoryGirl.create(:vote, :voteable => post, :like => false) post.reload post.vote_points.should == orig_vote_point - 1 end
However for Vote, the controller specs are empty. Why is it so? Dont we need to write controller specs as well? Why have the authors chose to omit controller specs and do testing this way?