Sha256: 8c025bc22f7c2970d3002a1eaa360e3023b3267d7c013f72017d6d01645ea3d4

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

require 'spec_helper'

feature 'Validating an email address', :vcr do

  background do
    PostcodeAnywhere::EmailValidation.key = ENV['POSTCODE_ANYWHERE_KEY']
  end

  scenario 'With valid format and valid DNS record' do
    expect(PostcodeAnywhere::EmailValidation.valid?('info@google.com')).to be_true
  end

  scenario 'With invalid format' do
    expect(PostcodeAnywhere::EmailValidation.valid?('@google.com')).to be_false
  end

  scenario 'With invalid DNS record' do
    expect(PostcodeAnywhere::EmailValidation.valid?('info@google.google')).to be_false
  end

  scenario 'Without API key' do
    PostcodeAnywhere::EmailValidation.key = 'AA11-AA11-AA11-AA11'

    expect { PostcodeAnywhere::EmailValidation.valid?('info@google.com') }.to raise_error(PostcodeAnywhere::EmailValidation::ValidationError)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
postcode_anywhere-email_validation-0.0.4 spec/features/email_validation_spec.rb
postcode_anywhere-email_validation-0.0.2 spec/features/email_validation_spec.rb