evt-messaging-fixtures 1.1.1.0 → 1.1.3.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: 9d6ce7dc5f801ca051e1bcf74b12705a0bcbd05ae5375895371705fb9820453c
4
- data.tar.gz: ba8c30bf0a8778c1347ba1db178e43ad0d61af603ea6b0d5c3ed4d489df1e5c2
3
+ metadata.gz: e4ef2a774aef994df0f13ae0ad49b8ac276c53e965ce5015d828ba421f0d4bfb
4
+ data.tar.gz: c8f79f24affdfb64e1f1048756382ef120aac5529f5c71b98d91340d4659bb40
5
5
  SHA512:
6
- metadata.gz: 727bec07b3c9e53b7868439477828257302a726bbb87a4f189301aab8d407f1424dea403403a4e0fd2083bcb8717a8b2ba5233c134f50b6a859c2589cad45702
7
- data.tar.gz: 396b221225b28855d488095201fda8372591d67cfeb93698844930074c716d1a42ca9ad836a1714f0a67067c6782ad85a0385ca122cf86eac3a14cc9c80d28e0
6
+ metadata.gz: 52d42ffaeebf8c89de5f1965eb75302246a04d05b2c1de3003a1516bad6fc5592db238d540019d5d23b73e4b021c8b591330b4cbb3bdc3514e746487e44e7085
7
+ data.tar.gz: e5a0949e5582d8e6124bad31f9bd666b8a2279ecc0f5438601d639dd14e8da453d3772c306ad8b35663260563053267348314e4ade64a1b6a0e3c3545c3f6bfd
@@ -50,6 +50,14 @@ module Messaging
50
50
  end
51
51
  end
52
52
 
53
+ module Random
54
+ def self.example_class
55
+ Class.new do
56
+ include Messaging::Message
57
+ end
58
+ end
59
+ end
60
+
53
61
  module Metadata
54
62
  def self.example
55
63
  metadata = Messaging::Message::Metadata.new
@@ -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,62 @@ module Messaging
22
22
  source_message_class.name.split('::').last
23
23
  end
24
24
 
25
- def title_context_name
26
- @title_context_name ||= "Message"
25
+ def print_title_context?
26
+ if @print_title_context.nil?
27
+ @print_title_context = true
28
+ end
29
+ @print_title_context
27
30
  end
28
31
 
29
- initializer :message, :source_message, na(:title_context_name), :test_block
32
+ def title_context_name
33
+ if @title_context_name.nil?
34
+ @title_context_name = "Message"
30
35
 
31
- def self.build(message, source_message=nil, title_context_name: nil, &test_block)
32
- new(message, source_message, title_context_name, test_block)
36
+ if not message.nil?
37
+ @title_context_name = "#{@title_context_name}: #{message_type}"
38
+ end
39
+ end
40
+
41
+ @title_context_name
33
42
  end
34
43
 
35
- def call
36
- context_name = title_context_name
44
+ initializer :message, :source_message, na(:print_title_context), na(:title_context_name), :test_block
37
45
 
38
- context context_name do
39
- if test_block.nil?
40
- raise Error, "Message fixture must be executed with a block"
41
- end
46
+ def self.build(message, source_message=nil, print_title_context: nil, title_context_name: nil, &test_block)
47
+ new(message, source_message, print_title_context, title_context_name, test_block)
48
+ end
42
49
 
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
50
+ def call
51
+ if print_title_context?
52
+ context "#{title_context_name}" do
53
+ call!
50
54
  end
55
+ else
56
+ call!
57
+ end
58
+ end
51
59
 
52
- detail "Message Class: #{message_class.name}"
60
+ def call!
61
+ if test_block.nil?
62
+ raise Error, "Message fixture must be executed with a block"
63
+ end
53
64
 
54
- if not source_message.nil?
55
- detail "Source Message Class: #{source_message_class.name}"
65
+ if message.nil?
66
+ test "Not nil" do
67
+ detail "Message: nil"
68
+ detail "Remaining message tests are skipped"
69
+ refute(message.nil?)
56
70
  end
71
+ return
72
+ end
57
73
 
58
- test_block.call(self)
74
+ detail "Message Class: #{message_class.name}"
75
+
76
+ if not source_message.nil?
77
+ detail "Source Message Class: #{source_message_class.name}"
59
78
  end
79
+
80
+ test_block.call(self)
60
81
  end
61
82
 
62
83
  def assert_attributes_assigned(attribute_names=nil)
@@ -6,7 +6,7 @@ module Messaging
6
6
  include TestBench::Fixture
7
7
  include Initializer
8
8
 
9
- initializer :message, :stream_name, :expected_version, :reply_stream_name, :test_block
9
+ initializer :message_class, :message, :stream_name, :expected_version, :reply_stream_name, :test_block
10
10
 
11
11
  def self.build(writer, message_class, &test_block)
12
12
  data = get_data(writer, message_class)
@@ -16,7 +16,7 @@ module Messaging
16
16
  expected_version = data&.expected_version
17
17
  reply_stream_name = data&.reply_stream_name
18
18
 
19
- new(message, stream_name, expected_version, reply_stream_name, test_block)
19
+ new(message_class, message, stream_name, expected_version, reply_stream_name, test_block)
20
20
  end
21
21
 
22
22
  def self.get_data(writer, message_class)
@@ -38,12 +38,7 @@ module Messaging
38
38
  end
39
39
 
40
40
  def call
41
- message_class = message&.class
42
-
43
- context_name = 'Write'
44
- if not message_class.nil?
45
- context_name = "#{context_name}: #{message_class&.message_type}"
46
- end
41
+ context_name = "Write: #{message_class.message_type}"
47
42
 
48
43
  context context_name do
49
44
  if test_block.nil?
@@ -55,14 +50,14 @@ module Messaging
55
50
  written = !message.nil?
56
51
 
57
52
  test "Written" do
58
- if not test_block.nil?
53
+ if not written
59
54
  detail "Remaining message tests are skipped"
60
55
  end
61
56
 
62
57
  assert(written)
63
58
  end
64
59
 
65
- return if !written
60
+ return if not written
66
61
 
67
62
  test_block.call(self)
68
63
  end
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.1.0
4
+ version: 1.1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-18 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
@@ -79,7 +79,7 @@ homepage: https://github.com/eventide-project/messaging-fixtures
79
79
  licenses:
80
80
  - MIT
81
81
  metadata: {}
82
- post_install_message:
82
+ post_install_message:
83
83
  rdoc_options: []
84
84
  require_paths:
85
85
  - lib
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubygems_version: 3.1.2
98
- signing_key:
98
+ signing_key:
99
99
  specification_version: 4
100
100
  summary: TestBench fixtures for the Messaging library
101
101
  test_files: []