Sha256: d7b0f7ba8391e802c6320128ce80640ae7587b8da3c98054cde5761e2606c142

Contents?: true

Size: 922 Bytes

Versions: 2

Compression:

Stored size: 922 Bytes

Contents

require 'helper'
require 'fileutils'

FileValidator = RichEmailValidator::FileValidator

describe FileValidator do
  let(:invalid_fixture_path) { fixture_path('list_fixture.txt') }
  let(:valid_fixture_path) { fixture_path('valid_fixture.txt') }

  describe '#filter' do
    let(:valid_list) { get_list('valid_fixture.txt') }
    it 'returns a list of valid emails' do
      output = FileValidator.new(invalid_fixture_path).filter
      expect(output).to eq(valid_list)
    end
  end

  describe '#export_valid_list' do
    let(:output_path) { fixture_path('output.tmp') }
    after(:each) { FileUtils.rm_rf(output_path) }
    it 'creates new file with with valid emails' do
      FileValidator.new(invalid_fixture_path).export_valid_list(output_path)
      output_data = File.read(output_path)
      valid_fixture_data = File.read(valid_fixture_path)
      expect(output_data).to eq(valid_fixture_data)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rich_email_validator-0.0.2 spec/rich_email_validator/file_validator_spec.rb
rich_email_validator-0.0.1 spec/rich_email_validator/file_validator_spec.rb