webspicy 0.20.16 → 0.20.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webspicy/tester/fakesendgrid/email.rb +7 -0
- data/lib/webspicy/tester/fakeses/email.rb +7 -0
- data/lib/webspicy/tester/fakesmtp/email.rb +8 -0
- data/lib/webspicy/version.rb +1 -1
- data/spec/unit/tester/fakesendgrid/test_email.rb +5 -1
- data/spec/unit/tester/fakeses/test_email.rb +6 -0
- data/spec/unit/tester/fakesmtp/test_email.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db9ccb05ac501d744769feebb3bb41d5775727fbf11b2507cd3d2aee6d0b6f10
|
4
|
+
data.tar.gz: 5b314097454003e48edd6e72a94e05f439709478586ac0eefb1a31eed1192d37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40dcc1ae84b4bd1146412435663e2d2198c53dc15cc858b5e88370656d6bf612b056b542cb7efef71b69dec395bbb0a36766b731f053c84b1f760c66e02ff942
|
7
|
+
data.tar.gz: 29744550467db7bd83ad6e102e8296fe4df99911f2b29c77af66488ef37320bbfecf8a37258e931cde4bd7b3a02715b733125e3fbefa73cbe13e72fd3bba511b
|
@@ -42,6 +42,13 @@ module Webspicy
|
|
42
42
|
@subject ||= data["subject"]
|
43
43
|
end
|
44
44
|
|
45
|
+
def headers
|
46
|
+
@headers ||= data["headers"].reduce(OpenStruct.new){|acc, (key, value)|
|
47
|
+
acc[key.downcase] = value
|
48
|
+
acc
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
45
52
|
end # class Email
|
46
53
|
end # class Fakesendgrid
|
47
54
|
end # class Tester
|
@@ -39,6 +39,13 @@ module Webspicy
|
|
39
39
|
recipients - cc - to
|
40
40
|
end
|
41
41
|
|
42
|
+
def headers
|
43
|
+
@headers ||= email.header.reduce(OpenStruct.new){|acc, h|
|
44
|
+
acc[h.name.downcase] = h.unparsed_value
|
45
|
+
acc
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
42
49
|
def email
|
43
50
|
@email ||= Mail.read_from_string(raw_data)
|
44
51
|
end
|
@@ -38,6 +38,14 @@ module Webspicy
|
|
38
38
|
.first
|
39
39
|
end
|
40
40
|
|
41
|
+
def headers
|
42
|
+
@headers ||= data["headerLines"]
|
43
|
+
.reduce(OpenStruct.new){|acc, h|
|
44
|
+
acc[h["key"].downcase] = h["line"].split(': ')[1..].join(': ')
|
45
|
+
acc
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
41
49
|
end # class Email
|
42
50
|
end # class Fakesmtp
|
43
51
|
end # class Tester
|
data/lib/webspicy/version.rb
CHANGED
@@ -44,7 +44,10 @@ module Webspicy
|
|
44
44
|
"value": "test <b>test</b> test",
|
45
45
|
"type": "text/html"
|
46
46
|
}
|
47
|
-
]
|
47
|
+
],
|
48
|
+
"headers": {
|
49
|
+
"x-header-key": "personalised-header-value"
|
50
|
+
}
|
48
51
|
}
|
49
52
|
J
|
50
53
|
|
@@ -58,6 +61,7 @@ module Webspicy
|
|
58
61
|
expect(subject.cc).to eql(["a-cc-recipient@world.com"])
|
59
62
|
expect(subject.bcc).to eql(["a-bcc-recipient@world.com"])
|
60
63
|
expect(subject.subject).to eql("Hello World")
|
64
|
+
expect(subject.headers['x-header-key']).to eql('personalised-header-value')
|
61
65
|
end
|
62
66
|
|
63
67
|
end
|
@@ -12,6 +12,7 @@ module Webspicy
|
|
12
12
|
To: someone@world.com, someoneelse@world.com
|
13
13
|
CC: a-cc-recipient@world.com
|
14
14
|
Subject: Hey world, hello!
|
15
|
+
X-Ses-Configuration-Set: SesConfigurationSet
|
15
16
|
Message-ID: <2421bae3-9c42-7988-23b4-b1f6168130c9@webspicy.io>
|
16
17
|
Date: Thu, 24 Jun 2021 13:45:16 +0000
|
17
18
|
MIME-Version: 1.0
|
@@ -55,6 +56,11 @@ module Webspicy
|
|
55
56
|
expect(subject.cc).to eql(["a-cc-recipient@world.com"])
|
56
57
|
expect(subject.bcc).to eql(["a-bcc-recipient@world.com"])
|
57
58
|
expect(subject.subject).to eql("Hey world, hello!")
|
59
|
+
expect(subject.headers[:from]).to eql("Webspicy <noreply@webspicy.io>")
|
60
|
+
expect(subject.headers[:cc]).to eql("a-cc-recipient@world.com")
|
61
|
+
expect(subject.headers["message-id"]).to eql("<2421bae3-9c42-7988-23b4-b1f6168130c9@webspicy.io>")
|
62
|
+
expect(subject.headers["mime-version"]).to eql("1.0")
|
63
|
+
expect(subject.headers["x-ses-configuration-set"]).to eql("SesConfigurationSet")
|
58
64
|
end
|
59
65
|
|
60
66
|
end
|
@@ -96,6 +96,10 @@ module Webspicy
|
|
96
96
|
expect(subject.to).to eql(["someone@world.com", "someoneelse@world.com"])
|
97
97
|
expect(subject.cc).to eql(["a-cc-recipient@world.com"])
|
98
98
|
expect(subject.subject).to eql("Hello World")
|
99
|
+
expect(subject.headers[:cc]).to eql("a-cc-recipient@world.com")
|
100
|
+
expect(subject.headers[:date]).to eql("Tue, 20 Apr 2021 14:06:13 +0000")
|
101
|
+
expect(subject.headers['message-id']).to eql("<607edfd56836e_1b0492af@1d3356d02030.mail>")
|
102
|
+
expect(subject.headers['mime-version']).to eql("1.0")
|
99
103
|
end
|
100
104
|
|
101
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webspicy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|