evt-messaging-fixtures 1.1.2.0 → 1.1.4.0

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: c1dfcf9207f5dc4d99225e4d10cedb57c57553910fdae1259b95fd523e82458d
4
- data.tar.gz: 71e15c7fe107ebacc567aaaf397126e9c53a4cee639a103d1c3e7fe243afb7ca
3
+ metadata.gz: bc5e3091ad4d8be8bde9f80803d3869e18b4e4c109462f971ec659a191ef4a6a
4
+ data.tar.gz: 93f87536e10acb084b6ad3aa8ba16f6f3df25ec85911a8cfd9000dce34cb686a
5
5
  SHA512:
6
- metadata.gz: c5c95528f3716e1dd971c70270197eae4e976c4a1f69a92f2ddc0b756284b0aa26897fffb0a95f5552742562dc00b6b436f49d421fb02533254b9f21aaa64a84
7
- data.tar.gz: 88a6b5b396274407cd4f0bbe862cb22221e7ed0200299ce083f500a5a80ba9f4edb1333e3681f6c3bac6fd4f34817f5ccc78f7679bb8721d6be89728b210a42b
6
+ metadata.gz: b380ec23b9c0a066bcac638c39fa17dc1e6f87dfacfb992e5bc5054ae1c09b9dc2e04d2eb7b8d36b3b531acad7cbaebad62fda69703884ab728d6358dd1c0222
7
+ data.tar.gz: 4b87775c9aaaa334fa061b8803b18503987fe5c24a3e3dcaceebb5c9f669abce4b26ac66499e049d1f2d68ab527b21b5b8b19d13cc05322520e9307999762f1a
@@ -34,19 +34,19 @@ module Messaging
34
34
 
35
35
  def call!
36
36
  test "Follows" do
37
- detail "Stream Name: #{source_metadata.stream_name.inspect}"
37
+ detail "Source Message Stream Name: #{source_metadata.stream_name.inspect}"
38
38
  detail "Causation Stream Name: #{metadata.causation_message_stream_name.inspect}"
39
39
 
40
- detail "Position: #{source_metadata.position.inspect}"
40
+ detail "Source Message Position: #{source_metadata.position.inspect}"
41
41
  detail "Causation Position: #{metadata.causation_message_position.inspect}"
42
42
 
43
- detail "Global Position: #{source_metadata.global_position.inspect}"
43
+ detail "Source Message Global Position: #{source_metadata.global_position.inspect}"
44
44
  detail "Causation Global Position: #{metadata.causation_message_global_position.inspect}"
45
45
 
46
- detail "Source Correlation Stream Name: #{source_metadata.correlation_stream_name.inspect}"
46
+ detail "Source Message Correlation Stream Name: #{source_metadata.correlation_stream_name.inspect}"
47
47
  detail "Correlation Stream Name: #{metadata.correlation_stream_name.inspect}"
48
48
 
49
- detail "Source Reply Stream Name: #{source_metadata.reply_stream_name.inspect}"
49
+ detail "Source Message Reply Stream Name: #{source_metadata.reply_stream_name.inspect}"
50
50
  detail "Reply Stream Name: #{metadata.reply_stream_name.inspect}"
51
51
 
52
52
  assert(metadata.follows?(source_metadata))
@@ -22,41 +22,71 @@ module Messaging
22
22
  source_message_class.name.split('::').last
23
23
  end
24
24
 
25
+ def print_title_context?
26
+ if @print_title_context.nil?
27
+ @print_title_context = true
28
+ end
29
+ @print_title_context
30
+ end
31
+
25
32
  def title_context_name
26
- @title_context_name ||= "Message"
33
+ if @title_context_name.nil?
34
+ @title_context_name = "Message"
35
+
36
+ if not message.nil?
37
+ @title_context_name = "#{@title_context_name}: #{message_type}"
38
+ end
39
+ end
40
+
41
+ @title_context_name
27
42
  end
28
43
 
29
- initializer :message, :source_message, na(:title_context_name), :test_block
44
+ def detail_message_class?
45
+ if @detail_message_class.nil?
46
+ @detail_message_class = true
47
+ end
48
+ @detail_message_class
49
+ end
30
50
 
31
- def self.build(message, source_message=nil, title_context_name: nil, &test_block)
32
- new(message, source_message, title_context_name, test_block)
51
+ initializer :message, :source_message, na(:print_title_context), na(:title_context_name), na(:detail_message_class), :test_block
52
+
53
+ def self.build(message, source_message=nil, print_title_context: nil, title_context_name: nil, detail_message_class: nil, &test_block)
54
+ new(message, source_message, print_title_context, title_context_name, detail_message_class, test_block)
33
55
  end
34
56
 
35
57
  def call
36
- context_name = title_context_name
37
-
38
- context context_name do
39
- if test_block.nil?
40
- raise Error, "Message fixture must be executed with a block"
58
+ if print_title_context?
59
+ context "#{title_context_name}" do
60
+ call!
41
61
  end
62
+ else
63
+ call!
64
+ end
65
+ end
42
66
 
43
- if message.nil?
44
- test "Not nil" do
45
- detail "Message: nil"
46
- detail "Remaining message tests are skipped"
47
- refute(message.nil?)
48
- end
49
- return
67
+ def call!
68
+ if test_block.nil?
69
+ raise Error, "Message fixture must be executed with a block"
70
+ end
71
+
72
+ if message.nil?
73
+ test "Not nil" do
74
+ detail "Message: nil"
75
+ detail "Remaining message tests are skipped"
76
+ refute(message.nil?)
50
77
  end
78
+ return
79
+ end
51
80
 
81
+ if detail_message_class?
52
82
  detail "Message Class: #{message_class.name}"
83
+ end
53
84
 
54
- if not source_message.nil?
55
- detail "Source Message Class: #{source_message_class.name}"
56
- end
57
-
58
- test_block.call(self)
85
+ if not source_message.nil?
86
+ detail "Source Message Class: #{source_message_class.name}"
59
87
  end
88
+
89
+ test_block.call(self)
60
90
  end
61
91
 
62
92
  def assert_attributes_assigned(attribute_names=nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-messaging-fixtures
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2.0
4
+ version: 1.1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-23 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_store