Just starting out here, I have a Article.rb model that stores articles.
So it has the article_body, title, etc. as properties.
I need to clean the title for bad characters, should I create a function that takes the title and returns the cleaned up title string in the Article.rb model?
I want to write a rpsec test for this also, preferrable TDD style so I need some guidance.
I have so far:
describle Article do
before(:each) do
a = Article.new
end
it 'should remove any commas from the title' do
end
end
You would probably want to take advantage of model callbacks such as before_save.
This will strip the commas before the save.
You would then want to do something like:
end