Could anyone please explain what this test code does? :
assert_difference(\'Post.count\') do
post :create, :post => { :title => \'Hi\', :body => \'T
This method is to verify that there is a numerical difference between first argument and the second argument. In Most cases first argument is a string which is like “Post.count”
and second argument is a block. In rails this is mostly used in functional testing to check if an object can be saved in the database. Logic is that before a new is object being saved, number of records in that particular table must be different from the number of records after the object is saved ( from 1 to be precise).