#11 Refactoring User Name Part 2
Mar 28, 2007 | 6 minutes | Refactoring, Testing
Testing and refactoring go hand in hand. Refactoring is all about improving code without changing its behavior. Testing is all about making sure you don't change the behavior while you are improving the code.
Hi Ryan,
Testing is about proving that the code is fit for purpose.
Regression testing is about proving that the modified/new code does not impact on the existing code - which is what you are hinting at above.
One other thing to consider is if first name or last name is an empty string. You can do something like:
[first_name, middle_initial_with_period, last_name].reject(&:blank?) * ' '
This will reject all blank values.
I think you mean something like this:
[f, m, l].reject{|i| i.empty?}.compact.join(" ")
Yay Ruby. ^.^
Hello,
Great site and great coding! I would like to see a railscast on Rspec. Any plans for that?
David :)
I cannot get autotest to work on XP. I get error message "couldn't find HOME environment.." What should I add to the environment variable setting in Window?
Regression testing is about proving that the modified/new code does not impact on the existing code - which is what you are hinting at above.
This episode has been updated for Rails 5 as a blog post. Model Tests in Rails 5
dunia inii