I have model:
class Answer < ActiveRecord::Base
def pending_edits
self.edits.where(:is_approved => nil)
end
def update_body (new_body)
update_attributes :old_body => self.body, :body => new_body
end
def current_accepted_edit
edits.find_by(:is_current => true)
end
1) Is it overkill and bad practice to test this methods since there are so simple ?
But I wrote tests for them anyway.So just in case
2)If I need to test them - Is it a good it block description
: in my rspec test?
it 'answer.pending edits_method' do
some testing code
end
You should test all of your public methods irrespective of size. So if the method can be called from outside of the class then you test it. That said don't test private/protected methods if they are used as composition for public api methods. Edit in response to your edit: I would do
it "returns pending edits" do
end