Improves readability and upgrade RSpec
Add unit tests for recent changes