refactored for rspec spec_helper and mock/stub