evt-messaging-fixtures 1.0.0.1 → 1.1.2.2

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: 6dabbdd5e085b64d012cbaf5ace9a9f610b5788c980a3e17410a6e8caeebc192
4
- data.tar.gz: a706e6e94fa33a35697f0bafeae2a2f2ae4a4c0f41551ea57cc2451281aa677d
3
+ metadata.gz: 8312a954b5f432236fff5110a3b8e7995aa31eedcdf28ae01c159a25b85ed195
4
+ data.tar.gz: 9d42fd7058998687de8b4317e592129c8ad0564275c697ae61a0b193dde575d7
5
5
  SHA512:
6
- metadata.gz: 79bc41a6bda26bde771dc9392bd5af989dcb1aa358bc565bc36f43c72ec4529536234faf17283eb972e3f639f2e90371cb2f483c2d63a2a50861b08946d92202
7
- data.tar.gz: cd8759dd0cf39e8e8ad581f3dd94f6ebc5484cdec4ab226b0a558a497bb5f8afaf4e11df898a413c175fc65b8c2ccdd85612eb332aea61b899e671c55b3588ef
6
+ metadata.gz: 28d1fc132b099276109c76abdd5ad07783a6a4247664efcbceccf368e481bb7af0a5f954eb9e6497827ca07f256ff3279ad0fb6c4249b4891ebcf095fd5e922f
7
+ data.tar.gz: dec2f6285a30768713723b615de98642103cdcce69f9a6bc05de6c9ffa1ceab68719216dec55a577464f3df1b049bb699fcdc272b56188be0cb95ffd6a86ce11
@@ -6,5 +6,5 @@ require 'messaging/fixtures/defaults'
6
6
  require 'messaging/fixtures/follows'
7
7
  require 'messaging/fixtures/metadata'
8
8
  require 'messaging/fixtures/message'
9
- require 'messaging/fixtures/write'
9
+ require 'messaging/fixtures/writer'
10
10
  require 'messaging/fixtures/handler'
@@ -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
@@ -93,7 +93,7 @@ module Messaging
93
93
  end
94
94
 
95
95
  def assert_write(message_class, &test_block)
96
- fixture = fixture(Write, handler.write, message_class, &test_block)
96
+ fixture = fixture(Writer, handler.write, message_class, &test_block)
97
97
  fixture.message
98
98
  end
99
99
 
@@ -102,7 +102,7 @@ module Messaging
102
102
 
103
103
  context_name = "No Write"
104
104
  if not message_class.nil?
105
- write_telemetry_data = Write.get_data(writer, message_class)
105
+ write_telemetry_data = Writer.get_data(writer, message_class)
106
106
  written = !write_telemetry_data.nil?
107
107
  context_name = "#{context_name}: #{message_class.message_type}"
108
108
  else
@@ -23,7 +23,15 @@ module Messaging
23
23
  end
24
24
 
25
25
  def title_context_name
26
- @title_context_name ||= "Message"
26
+ if @title_context_name.nil?
27
+ @title_context_name = "Message"
28
+
29
+ if not message.nil?
30
+ @title_context_name = "#{@title_context_name}: #{message_type}"
31
+ end
32
+ end
33
+
34
+ @title_context_name
27
35
  end
28
36
 
29
37
  initializer :message, :source_message, na(:title_context_name), :test_block
@@ -68,6 +76,7 @@ module Messaging
68
76
  attributes_context_name: "Attributes Assigned"
69
77
  )
70
78
  end
79
+ alias :assert_all_attributes_assigned :assert_attributes_assigned
71
80
 
72
81
  def assert_attributes_copied(attribute_names=nil)
73
82
  if source_message.nil?
@@ -1,12 +1,12 @@
1
1
  module Messaging
2
2
  module Fixtures
3
- class Write
3
+ class Writer
4
4
  Error = Class.new(RuntimeError)
5
5
 
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.0.0.1
4
+ version: 1.1.2.2
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-14 00:00:00.000000000 Z
11
+ date: 2020-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_store
@@ -74,12 +74,12 @@ files:
74
74
  - lib/messaging/fixtures/handler.rb
75
75
  - lib/messaging/fixtures/message.rb
76
76
  - lib/messaging/fixtures/metadata.rb
77
- - lib/messaging/fixtures/write.rb
77
+ - lib/messaging/fixtures/writer.rb
78
78
  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: []