Sha256: 08769df61a8580a9bd48eace3c552013f0ed3846d2bc03d958ed9581694a2c2f

Contents?: true

Size: 817 Bytes

Versions: 3

Compression:

Stored size: 817 Bytes

Contents

require 'spec_helper'
require 'ronin/email_address'

describe EmailAddress do
  let(:user) { 'joe' }
  let(:host) { 'example.com' }
  let(:email) { "#{user}@#{host}" }

  subject {
    EmailAddress.new(
      :user_name => {:name => user},
      :host_name => {:address => host}
    )
  }

  describe "parse" do
    it "should parse email addresses" do
      email_address = EmailAddress.parse(email)

      email_address.user_name.name.should == user
      email_address.host_name.address.should == host
    end

    it "should strip whitespace from emails" do
      email_address = EmailAddress.parse("  #{email} ")

      email_address.user_name.name.should == user
      email_address.host_name.address.should == host
    end
  end

  it "should convert to a String" do
    subject.to_s.should == email
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ronin-1.0.0.pre3 spec/email_address_spec.rb
ronin-1.0.0.pre2 spec/email_address_spec.rb
ronin-1.0.0.pre1 spec/email_address_spec.rb