webspicy 0.20.5 → 0.20.6

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
  SHA256:
3
- metadata.gz: cf642b32d3e6abe3f90e53c047b8e1e973910041133ba4626d9ba7c2cb5ba333
4
- data.tar.gz: 95860fd2e93a11f5dcecf7e175371eee6378e073ee60e22ea266c44e69265d19
3
+ metadata.gz: 013055707cad05016cb794561d47a0408d39d6f462387c9eb66d31542ff2218c
4
+ data.tar.gz: b4c4778275ec96271b711ea0956c539fa35bf12b04d635fbc5062698996e7902
5
5
  SHA512:
6
- metadata.gz: 8415d763e56aec8f101d7140974e1ce959da7b1b0cc405c81c64976481a49b3042b442779973fe1eac76e20d9283e8aa6abb1c1363021c7c79d8f70fae59b482
7
- data.tar.gz: 8bdfbf03a2c792fb1d772ec2260227ec24b0bfc87f4df5bf70e0baf2376818ed580f43e41d6ef1b4c753e5bc3cc620dcae1479501baea2a5cc84d65ad7370394
6
+ metadata.gz: fcc079537f13b76af0e433c8591529824ea1e4f8b255f1411963e88cbd4df6953598504413dc8ad3da6db3005cf2c49867e80790594e3fb56cab039f2de450c7
7
+ data.tar.gz: e4479277fcec22a0928ae75a0120bc5c0a9644e73be6bb75a577dd33a42a03c445996b9b846a33bd20e6e439b4047a8f3ab4a418abb965777b4ce047e1824d7e
@@ -21,6 +21,19 @@ module Webspicy
21
21
  .map{|h| h["line"][/To:\s*(.*)$/, 1] }
22
22
  end
23
23
 
24
+ def reply_to
25
+ @reply_to ||= data["headerLines"]
26
+ .select{|h| h["key"] == "reply-to" }
27
+ .map{|h| h["line"][/Reply-To:\s*(.*)$/, 1] }
28
+ end
29
+
30
+ def subject
31
+ @subject ||= data["headerLines"]
32
+ .select{|h| h["key"] == "subject" }
33
+ .map{|h| h["line"][/Subject:\s*(.*)$/, 1] }
34
+ .first
35
+ end
36
+
24
37
  end # class Email
25
38
  end # class Fakesmtp
26
39
  end # class Tester
@@ -51,12 +51,16 @@ module Webspicy
51
51
  end
52
52
 
53
53
  def before_service
54
- io.puts spec_file_line(spec_file)
55
- io.puts
56
- io.flush
54
+ @spec_file_line_printed = false
57
55
  end
58
56
 
59
57
  def before_test_case
58
+ unless @spec_file_line_printed
59
+ io.puts spec_file_line(spec_file)
60
+ io.puts
61
+ io.flush
62
+ @spec_file_line_printed = true
63
+ end
60
64
  io.puts service_line(service, test_case)
61
65
  io.flush
62
66
  end
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 20
5
- TINY = 5
5
+ TINY = 6
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -0,0 +1,93 @@
1
+ require 'spec_helper'
2
+ require 'webspicy/tester/fakesmtp'
3
+ module Webspicy
4
+ class Tester
5
+ class Fakesmtp
6
+ describe Email do
7
+
8
+ DATA = JSON.parse <<~J
9
+ {
10
+ "attachments": [],
11
+ "headerLines": [
12
+ {
13
+ "key": "date",
14
+ "line": "Date: Tue, 20 Apr 2021 14:06:13 +0000"
15
+ },
16
+ {
17
+ "key": "from",
18
+ "line": "From: info@mydomain.be"
19
+ },
20
+ {
21
+ "key": "reply-to",
22
+ "line": "Reply-To: test@email.be"
23
+ },
24
+ {
25
+ "key": "to",
26
+ "line": "To: support@mydomain.fr"
27
+ },
28
+ {
29
+ "key": "message-id",
30
+ "line": "Message-ID: <607edfd56836e_1b0492af@1d3356d02030.mail>"
31
+ },
32
+ {
33
+ "key": "subject",
34
+ "line": "Subject: Hello World"
35
+ },
36
+ {
37
+ "key": "mime-version",
38
+ "line": "Mime-Version: 1.0"
39
+ }
40
+ ],
41
+ "html": "<p>Hello World!!</p>",
42
+ "text": "Hello World!!",
43
+ "textAsHtml": "Hello World!!",
44
+ "subject": "Hello World",
45
+ "date": "2021-04-20T14:06:13.000Z",
46
+ "to": {
47
+ "value": [
48
+ {
49
+ "address": "support@mydomain.fr",
50
+ "name": ""
51
+ }
52
+ ],
53
+ "html": "<span class=\\"mp_address_group\\"><a href=\\"mailto:support@mydomain.fr\\" class=\\"mp_address_email\\">support@mydomain.fr</a></span>",
54
+ "text": "support@mydomain.fr"
55
+ },
56
+ "from": {
57
+ "value": [
58
+ {
59
+ "address": "info@mydomain.be",
60
+ "name": ""
61
+ }
62
+ ],
63
+ "html": "<span class=\\"mp_address_group\\"><a href=\\"mailto:info@mydomain.be\\" class=\\"mp_address_email\\">info@mydomain.be</a></span>",
64
+ "text": "info@mydomain.be"
65
+ },
66
+ "messageId": "<607edfd56836e_1b0492af@1d3356d02030.mail>",
67
+ "replyTo": {
68
+ "value": [
69
+ {
70
+ "address": "test@email.be",
71
+ "name": ""
72
+ }
73
+ ],
74
+ "html": "<span class=\\"mp_address_group\\"><a href=\\"mailto:test@email.be\\" class=\\"mp_address_email\\">test@email.be</a></span>",
75
+ "text": "test@email.be"
76
+ }
77
+ }
78
+ J
79
+
80
+ subject{
81
+ Email.new(DATA)
82
+ }
83
+
84
+ it 'works as expected' do
85
+ expect(subject.from).to eql("info@mydomain.be")
86
+ expect(subject.to).to eql(["support@mydomain.fr"])
87
+ expect(subject.subject).to eql("Hello World")
88
+ end
89
+
90
+ end
91
+ end
92
+ end
93
+ 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.5
4
+ version: 0.20.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -313,6 +313,7 @@ files:
313
313
  - spec/unit/support/world/test_world.rb
314
314
  - spec/unit/test_configuration.rb
315
315
  - spec/unit/tester/fakeses/test_email.rb
316
+ - spec/unit/tester/fakesmtp/test_email.rb
316
317
  - spec/unit/tester/test_asserter.rb
317
318
  - spec/unit/tester/test_assertions.rb
318
319
  - spec/unit/web/mocker/test_mocker.rb
@@ -325,7 +326,7 @@ homepage: http://github.com/enspirit/webspicy
325
326
  licenses:
326
327
  - MIT
327
328
  metadata: {}
328
- post_install_message:
329
+ post_install_message:
329
330
  rdoc_options: []
330
331
  require_paths:
331
332
  - lib
@@ -341,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
342
  version: '0'
342
343
  requirements: []
343
344
  rubygems_version: 3.2.1
344
- signing_key:
345
+ signing_key:
345
346
  specification_version: 4
346
347
  summary: Webspicy helps testing web services as software operation black boxes!
347
348
  test_files: []