block_head 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ddfec6e0b29d6d98df65d0937f5e5c04793514f
4
- data.tar.gz: c2f64afdfd897a35fc1932d5de40b0bcfc9d9580
3
+ metadata.gz: e1e38fcca27dada17d3423f2a0e62dde337695bf
4
+ data.tar.gz: 628586da4b3987d87bc6f3946eadabdcee1748e0
5
5
  SHA512:
6
- metadata.gz: 7870f73dcc6a69aede9dde18d186defde3c6528e74491ccea2615ac8586993eb868876672b32e0a896754b931f0f9f1793efb9df4fc4495fcc6510c204090d7c
7
- data.tar.gz: 06a2587474f1aa857c22fc0e83f2996e9dfa3765bbc7e9682fa1b51918306ccd7cd6bed48bebd52258ccc75ae48f0c42e515b380639790854ce6f1634ccb1c77
6
+ metadata.gz: ee6af40430cdeeaef9fd1c7626a1c19a6da03847911e7d1805ead20f552dc4c30e65466ed4d08cd409f7b2bff47587b2b35108eacf21d747c3d2b690b1cafc9a
7
+ data.tar.gz: 64ff68e99b9d72b3fc9c905a23c1bceca6aa0538db1fdddbc1b7f6ed5e0f440480ad8a077c0527061acf33f2ddeddd2db34d6a1c4ab2e1f6902749c2ddee418a
@@ -5,14 +5,18 @@ class DomainInterceptor
5
5
  end
6
6
 
7
7
  def delivering_email(message)
8
- message.to = default_recipient unless destination_has_valid_domain?(message)
8
+ unless destination_has_valid_domain?(message)
9
+ message.to = default_recipient
10
+ end
9
11
  end
10
12
 
11
13
  private
12
14
 
13
15
  def destination_has_valid_domain?(message)
14
- recipient_domain = message.to.split("@")[1]
15
- domains.include?(recipient_domain)
16
+ message.to.any? do |recipient|
17
+ recipient_domain = recipient.split("@")[1]
18
+ domains.include?(recipient_domain)
19
+ end
16
20
  end
17
21
 
18
22
  attr_reader :domains, :default_recipient
@@ -1,3 +1,3 @@
1
1
  module BlockHead
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -5,18 +5,18 @@ require 'spec_helper'
5
5
  describe DomainInterceptor do
6
6
  subject(:interceptor) { DomainInterceptor.new([domain], default_recipient) }
7
7
  let(:default_recipient) { "default@gust.com" }
8
- let(:domain) { "gust.com" }
8
+ let(:domain) { "hotmail.com" }
9
9
 
10
10
  describe "#delivering_email" do
11
11
  let(:message) { double(:message) }
12
12
 
13
13
  before do
14
- allow(message).to receive(:to) { destination_address }
14
+ allow(message).to receive(:to) { [destination_address] }
15
15
  allow(message).to receive(:to=)
16
16
  end
17
17
 
18
18
  context "when the given email matches any of the domains given" do
19
- let(:destination_address) { "noah@gust.com" }
19
+ let(:destination_address) { "noah@hotmail.com" }
20
20
 
21
21
  it "does not manipulate the destination of the given email" do
22
22
  interceptor.delivering_email(message)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: block_head
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Letizia