Guest User

Untitled

a guest
Jan 23rd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. 1 require File.dirname(__FILE__) + "/spec_helper"
  2. 2
  3. 3 require 'email'
  4. 4
  5. 5 describe Email do
  6. 6 describe '.normalize', ' should strip email down to core address' do
  7. 7 def self.normalized(original, options)
  8. 8 it %{normalizes '#{original}' as '#{options[:should_be]}'} do
  9. 9 Email.normalize(original).should == options[:should_be]
  10. 10 end
  11. 11 end
  12. 12
  13. 13 normalized('Joe Blow <joe@somewhere.com>', :should_be => 'joe@somewhere.com')
  14. 14 normalized('"Joe Blow" <joe@somewhere.com>', :should_be => 'joe@somewhere.com')
  15. 15
  16. 16 describe 'it strips whitespace' do
  17. 17 normalized(' joe@somewhere.com', :should_be => 'joe@somewhere.com')
  18. 18 end
  19. 19
  20. 20 describe "it doesn't choke on invalid addresses" do
  21. 21 normalized('notanemail <ddsd>', :should_be => 'ddsd')
  22. 22 normalized('xyz', :should_be => 'xyz')
  23. 23 end
  24. 24 end
  25. 25 end
Add Comment
Please, Sign In to add comment