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