email_test_helpers 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0538aa876a3c1fe1a8e5aca383fa1fe1cd36f73
4
- data.tar.gz: 6eecc3f0c03687735e5c199930ac58b6ce3770ce
3
+ metadata.gz: 489dc5aa63d9bc212696d82c38049886e0bd8368
4
+ data.tar.gz: 32c35f3e4580779418c1da1a29171100929746f8
5
5
  SHA512:
6
- metadata.gz: 58ed5ac1e661b31b4d980e5193177bcfb1703d20ecf33455c773996c77ea71abec30a66a990c927390674bd087c6fc340004578c96e9f5cf0798e1324e3b41b1
7
- data.tar.gz: da6509b6789ca8dedce262ebb109a36745a0027ac3b001aafbccef43b337f43c54137562632185cc8020fe74cae4ffd22e5456cc959287f26a2befba1fad775d
6
+ metadata.gz: 7bffbe0d2d329a90d50976222a65e821a906af9b626462a2322261b67c72ff07320b1cc9f02eea35ce2e6a3d25ab4d8663b8dd556498298e34cb9a043981325a
7
+ data.tar.gz: 553c690856d7e719a3b5f66ca9729c054260e47823a8947e4ca604a627aa011909b339cb405b415ac829c171facb513ed1e2bb1651a573e1b4fcbcf6da4b1c99
@@ -52,13 +52,23 @@ module EmailTestHelpers
52
52
  private
53
53
 
54
54
  def email_body(mail = last_email)
55
- mail.body.raw_source
55
+ if multipart?
56
+ mail.body.parts.select do |part|
57
+ part.content_type.starts_with?('text/')
58
+ end.map(&:body).map(&:raw_source).join
59
+ else
60
+ mail.body.raw_source
61
+ end
56
62
  end
57
63
 
58
64
  def last_email
59
65
  @last_email || find_email
60
66
  end
61
67
 
68
+ def multipart?(mail = last_email)
69
+ mail.parts.any?
70
+ end
71
+
62
72
  def validate_options(options)
63
73
  valid_keys = [:to, :cc, :bcc, :subject, :body]
64
74
  invalid_keys = options.keys - valid_keys
@@ -1,3 +1,3 @@
1
1
  module EmailTestHelpers
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_test_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zubin Henner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer