ruby_event_store-rspec 2.0.3 → 2.1.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: de2f847d6e871bbb4fc05f5a86fc99b1aca4ad78d5a8d560c7ac6425db0675f9
4
- data.tar.gz: 7dda9bced00bcb0cbf1b37acbbcffa0fea2c38b391d326a3f5211a218d52b19f
3
+ metadata.gz: e1362df53ba19bf0a2194492d627ab17cd22ee658c9fefa47b5c61c0b8eec562
4
+ data.tar.gz: c665c377cf751768cb1ec6abd8f486231ae382c6dafaef36e8cf0aaf01bc3800
5
5
  SHA512:
6
- metadata.gz: d34a62d9cbe7bbb3091cfcdd6eba27e5d76b3475e8b091f8bbec4ff81033e07aa2b72cd18608e164845aeea32cd3bf454b1a7df87ec047c524013efb9d1262e1
7
- data.tar.gz: 984db3c621b05408f8311b95c69af1282acd449da63f081586d728467620040861330a9069af3c8a7817564ca577643c3b2c01c3429587b1896bdfcf064a9d27
6
+ metadata.gz: 94e802c2bbed41e35aa8f8a2507cc127afe2e853e2266d60a56ea240f98c09f357bf7c664e7489de95a3f69d0b4892cd7f50a1c261fe2e7c995b531b45518fe4
7
+ data.tar.gz: bf4cc3ec24389daf273187565731d7dc460e2d2ba9621605dafbbce46b19df9324f27cc98deb8c749955e15b10a3c6dd8167f36ae07fbea0592a2c2b8e884261
data/README.md CHANGED
@@ -1,206 +1,6 @@
1
- # RailsEventStore::RSpec
1
+ # RubyEventStore::RSpec
2
2
 
3
- ## Installation
3
+ RSpec matchers for RubyEventStore.
4
4
 
5
- Add this line to your application's Gemfile:
5
+ Find out more at [https://railseventstore.org](https://railseventstore.org/)
6
6
 
7
- ```ruby
8
- group :test do
9
- gem 'ruby_event_store-rspec'
10
- end
11
- ```
12
-
13
- ## Usage
14
-
15
- ### be_event
16
-
17
- The `be_event` matcher enables you to make expectations on a domain event. It exposes fluent interface.
18
-
19
- ```ruby
20
- OrderPlaced = Class.new(RubyEventStore::Event)
21
- domain_event = OrderPlaced.new(
22
- data: {
23
- order_id: 42,
24
- net_value: BigDecimal.new("1999.0")
25
- },
26
- metadata: {
27
- remote_ip: '1.2.3.4'
28
- }
29
- )
30
-
31
- expect(domain_event)
32
- .to(be_an_event(OrderPlaced)
33
- .with_data(order_id: 42, net_value: BigDecimal.new("1999.0"))
34
- .with_metadata(remote_ip: '1.2.3.4'))
35
- ```
36
-
37
- By default the behaviour of `with_data` and `with_metadata` is not strict, that is the expectation is met when all specified values for keys match. Additional data or metadata that is not specified to be expected does not change the outcome.
38
-
39
- ```ruby
40
- domain_event = OrderPlaced.new(
41
- data: {
42
- order_id: 42,
43
- net_value: BigDecimal.new("1999.0")
44
- }
45
- )
46
-
47
- # this would pass even though data contains also net_value
48
- expect(domain_event).to be_an_event(OrderPlaced).with_data(order_id: 42)
49
- ```
50
-
51
- This matcher is both [composable](http://rspec.info/blog/2014/01/new-in-rspec-3-composable-matchers/) and accepting [built-in matchers](https://relishapp.com/rspec/rspec-expectations/v/3-6/docs/built-in-matchers) as a part of an expectation.
52
-
53
- ```ruby
54
- expect(domain_event).to be_an_event(OrderPlaced).with_data(order_id: kind_of(Integer))
55
- expect([domain_event]).to include(an_event(OrderPlaced))
56
- ```
57
-
58
- If you depend on matching the exact data or metadata, there's a `strict` modifier.
59
-
60
- ```ruby
61
- domain_event = OrderPlaced.new(
62
- data: {
63
- order_id: 42,
64
- net_value: BigDecimal.new("1999.0")
65
- }
66
- )
67
-
68
- # this would fail as data contains unexpected net_value
69
- expect(domain_event).to be_an_event(OrderPlaced).with_data(order_id: 42).strict
70
- ```
71
-
72
- Mind that `strict` makes both `with_data` and `with_metadata` behave in a stricter way. If you need to mix both, i.e. strict data but non-strict metadata then consider composing matchers.
73
-
74
- ```ruby
75
- expect(domain_event)
76
- .to(be_event(OrderPlaced).with_data(order_id: 42, net_value: BigDecimal.new("1999.0")).strict
77
- .and(an_event(OrderPlaced).with_metadata(timestamp: kind_of(Time)))
78
- ```
79
-
80
- You may have noticed the same matcher being referenced as `be_event`, `be_an_event` and `an_event`. There's also just `event`. Use whichever reads better grammatically.
81
-
82
- ### have_published
83
-
84
- Use this matcher to target `event_store` and reading from streams specifically.
85
- In a simplest form it would read all streams backward up to a page limit (100 events) and check whether the expectation holds true. Its behaviour can be best compared to the `include` matcher — it is satisfied by at least one element present in the collection. You're encouraged to compose it with `be_event`.
86
-
87
- ```ruby
88
- event_store = RailsEventStore::Client.new
89
- event_store.publish(OrderPlaced.new(data: { order_id: 42 }))
90
-
91
- expect(event_store).to have_published(an_event(OrderPlaced))
92
- ```
93
-
94
- Expectation can be narrowed to the specific stream.
95
-
96
- ```ruby
97
- event_store = RailsEventStore::Client.new
98
- event_store.publish(OrderPlaced.new(data: { order_id: 42 }), stream_name: "Order$42")
99
-
100
- expect(event_store).to have_published(an_event(OrderPlaced)).in_stream("Order$42")
101
- ```
102
-
103
- It is sometimes important to ensure no additional events have been published. Luckliy there's a modifier to cover that usecase.
104
-
105
- ```ruby
106
- expect(event_store).not_to have_published(an_event(OrderPlaced)).once
107
- expect(event_store).to have_published(an_event(OrderPlaced)).exactly(2).times
108
- ```
109
-
110
- Finally you can make expectation on several events at once.
111
-
112
- ```ruby
113
- expect(event_store).to have_published(
114
- an_event(OrderPlaced),
115
- an_event(OrderExpired).with_data(expired_at: be_between(Date.yesterday, Date.tomorrow))
116
- )
117
- ```
118
-
119
- If there's a usecase not covered by examples above or you need a different set of events to make expectations on you can always resort to a more verbose approach and skip `have_published`.
120
-
121
- ```ruby
122
- expect(event_store.read_events_forward("OrderAuditLog$42", count: 2)).to eq([
123
- an_event(OrderPlaced),
124
- an_event(OrderExpired)
125
- ])
126
- ```
127
-
128
- ### have_applied
129
-
130
- This matcher is intended to be used on [aggregate root](https://github.com/RailsEventStore/rails_event_store/tree/master/aggregate_root#usage). Behaviour is almost identical to `have_published` counterpart, except the concept of stream. Expecations are made against internal unpublished events collection.
131
-
132
- ```ruby
133
- class Order
134
- include AggregateRoot
135
- HasBeenAlreadySubmitted = Class.new(StandardError)
136
- HasExpired = Class.new(StandardError)
137
-
138
- def initialize
139
- self.state = :new
140
- # any other code here
141
- end
142
-
143
- def submit
144
- raise HasBeenAlreadySubmitted if state == :submitted
145
- raise HasExpired if state == :expired
146
- apply OrderSubmitted.new(data: {delivery_date: Time.now + 24.hours})
147
- end
148
-
149
- def expire
150
- apply OrderExpired.new
151
- end
152
-
153
- private
154
- attr_accessor :state
155
-
156
- def apply_order_submitted(event)
157
- self.state = :submitted
158
- end
159
-
160
- def apply_order_expired(event)
161
- self.state = :expired
162
- end
163
- end
164
- ```
165
-
166
- ```ruby
167
- aggregate_root = Order.new
168
- aggregate_root.submit
169
-
170
- expect(aggregate_root).to have_applied(event(OrderSubmitted)).once
171
- ```
172
-
173
- ### have_subscribed_to_events
174
-
175
- Use this matcher to make sure that a handler has subscribed to events in target `event_store` or not.
176
-
177
- ```ruby
178
- event_store = RailsEventStore::Client.new
179
-
180
- # it will pass if Handler has subscribed to both events
181
- expect(Handler).to have_subscribed_to_events(FooEvent, BarEvent).in(event_store)
182
-
183
- # it will fail if Handler has subscribed to any event
184
- expect(Handler).not_to have_subscribed_to_events(FooEvent, BarEvent).in(event_store)
185
- ```
186
- ## Code status
187
-
188
- [![Build Status](https://travis-ci.org/RailsEventStore/rails_event_store-rspec.svg?branch=master)](https://travis-ci.org/RailsEventStore/rails_event_store-rspec)
189
- [![Gem Version](https://badge.fury.io/rb/rails_event_store-rspec.svg)](https://badge.fury.io/rb/rails_event_store-rspec)
190
-
191
- We're aiming for 100% mutation coverage in this project. This is why:
192
-
193
- * [Why I want to introduce mutation testing to the rails_event_store gem](https://blog.arkency.com/2015/04/why-i-want-to-introduce-mutation-testing-to-the-rails-event-store-gem/)
194
- * [Mutation testing and continuous integration](https://blog.arkency.com/2015/05/mutation-testing-and-continuous-integration/)
195
-
196
- Whenever you fix a bug or add a new feature, we require that the coverage doesn't go down.
197
-
198
- ## Development
199
-
200
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
201
-
202
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
203
-
204
- ## Contributing
205
-
206
- Bug reports and pull requests are welcome on GitHub at https://github.com/RailsEventStore/rails_event_store-rspec.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RubyEventStore
4
4
  module RSpec
5
- VERSION = "2.0.3"
5
+ VERSION = "2.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_event_store-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-01 00:00:00.000000000 Z
11
+ date: 2021-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -25,17 +25,13 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  description:
28
- email:
29
- - dev@arkency.com
28
+ email: dev@arkency.com
30
29
  executables: []
31
30
  extensions: []
32
- extra_rdoc_files: []
31
+ extra_rdoc_files:
32
+ - README.md
33
33
  files:
34
- - Gemfile
35
- - Gemfile.lock
36
- - Makefile
37
34
  - README.md
38
- - lib/rails_event_store/rspec.rb
39
35
  - lib/ruby_event_store/rspec.rb
40
36
  - lib/ruby_event_store/rspec/apply.rb
41
37
  - lib/ruby_event_store/rspec/be_event.rb
@@ -45,13 +41,11 @@ files:
45
41
  - lib/ruby_event_store/rspec/matchers.rb
46
42
  - lib/ruby_event_store/rspec/publish.rb
47
43
  - lib/ruby_event_store/rspec/version.rb
48
- - rails_event_store-rspec.gemspec
49
- - ruby_event_store-rspec.gemspec
50
44
  homepage: https://railseventstore.org
51
45
  licenses:
52
46
  - MIT
53
47
  metadata:
54
- homepage_uri: https://railseventstore.org/
48
+ homepage_uri: https://railseventstore.org
55
49
  changelog_uri: https://github.com/RailsEventStore/rails_event_store/releases
56
50
  source_code_uri: https://github.com/RailsEventStore/rails_event_store
57
51
  bug_tracker_uri: https://github.com/RailsEventStore/rails_event_store/issues
@@ -63,7 +57,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - ">="
65
59
  - !ruby/object:Gem::Version
66
- version: '0'
60
+ version: '2.5'
67
61
  required_rubygems_version: !ruby/object:Gem::Requirement
68
62
  requirements:
69
63
  - - ">="
@@ -73,5 +67,5 @@ requirements: []
73
67
  rubygems_version: 3.1.4
74
68
  signing_key:
75
69
  specification_version: 4
76
- summary: RSpec matchers for RailsEventStore
70
+ summary: RSpec matchers for RubyEventStore
77
71
  test_files: []
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
- gemspec name: 'ruby_event_store-rspec'
4
-
5
- eval_gemfile '../support/bundler/Gemfile.shared'
6
-
7
- gem 'ruby_event_store', path: '../ruby_event_store'
8
- gem 'aggregate_root', path: '../aggregate_root'
9
-
10
- gem 'diff-lcs', '= 1.3.0'
data/Gemfile.lock DELETED
@@ -1,118 +0,0 @@
1
- PATH
2
- remote: ../aggregate_root
3
- specs:
4
- aggregate_root (2.0.3)
5
- ruby2_keywords
6
- ruby_event_store (= 2.0.3)
7
-
8
- PATH
9
- remote: ../ruby_event_store
10
- specs:
11
- ruby_event_store (2.0.3)
12
- concurrent-ruby (~> 1.0, >= 1.1.6)
13
-
14
- PATH
15
- remote: .
16
- specs:
17
- ruby_event_store-rspec (2.0.3)
18
- rspec (~> 3.0)
19
-
20
- GEM
21
- remote: https://oss:7AXfeZdAfCqL1PvHm2nvDJO6Zd9UW8IK@gem.mutant.dev/
22
- specs:
23
- abstract_type (0.0.7)
24
- adamantium (0.2.0)
25
- ice_nine (~> 0.11.0)
26
- memoizable (~> 0.4.0)
27
- anima (0.3.2)
28
- abstract_type (~> 0.0.7)
29
- adamantium (~> 0.2)
30
- equalizer (~> 0.0.11)
31
- ast (2.4.1)
32
- concord (0.1.6)
33
- adamantium (~> 0.2.0)
34
- equalizer (~> 0.0.9)
35
- concurrent-ruby (1.1.9)
36
- equalizer (0.0.11)
37
- ice_nine (0.11.2)
38
- memoizable (0.4.2)
39
- thread_safe (~> 0.3, >= 0.3.1)
40
- mprelude (0.1.0)
41
- abstract_type (~> 0.0.7)
42
- adamantium (~> 0.2.0)
43
- concord (~> 0.1.5)
44
- equalizer (~> 0.0.9)
45
- ice_nine (~> 0.11.1)
46
- procto (~> 0.0.2)
47
- mutant-license (0.1.1.2.1627430819213747598431630701693729869473.0)
48
- parser (3.0.0.0)
49
- ast (~> 2.4.1)
50
- procto (0.0.3)
51
- rspec-core (3.10.1)
52
- rspec-support (~> 3.10.0)
53
- rspec-expectations (3.10.1)
54
- diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.10.0)
56
- rspec-mocks (3.10.1)
57
- diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.10.0)
59
- rspec-support (3.10.1)
60
- ruby2_keywords (0.0.5)
61
- thread_safe (0.3.6)
62
- unparser (0.5.6)
63
- abstract_type (~> 0.0.7)
64
- adamantium (~> 0.2.0)
65
- anima (~> 0.3.1)
66
- concord (~> 0.1.5)
67
- diff-lcs (~> 1.3)
68
- equalizer (~> 0.0.9)
69
- mprelude (~> 0.1.0)
70
- parser (>= 3.0.0)
71
- procto (~> 0.0.2)
72
- variable (0.0.1)
73
- equalizer (~> 0.0.11)
74
-
75
- GEM
76
- remote: https://rubygems.org/
77
- specs:
78
- diff-lcs (1.3)
79
- mutant (0.10.22)
80
- abstract_type (~> 0.0.7)
81
- adamantium (~> 0.2.0)
82
- anima (~> 0.3.1)
83
- ast (~> 2.2)
84
- concord (~> 0.1.5)
85
- diff-lcs (~> 1.3)
86
- equalizer (~> 0.0.9)
87
- ice_nine (~> 0.11.1)
88
- memoizable (~> 0.4.2)
89
- mprelude (~> 0.1.0)
90
- parser (~> 3.0.0)
91
- procto (~> 0.0.2)
92
- unparser (~> 0.5.6)
93
- variable (~> 0.0.1)
94
- mutant-rspec (0.10.22)
95
- mutant (= 0.10.22)
96
- rspec-core (>= 3.8.0, < 4.0.0)
97
- rake (13.0.3)
98
- rspec (3.10.0)
99
- rspec-core (~> 3.10.0)
100
- rspec-expectations (~> 3.10.0)
101
- rspec-mocks (~> 3.10.0)
102
-
103
- PLATFORMS
104
- ruby
105
-
106
- DEPENDENCIES
107
- aggregate_root!
108
- diff-lcs (= 1.3.0)
109
- mutant (~> 0.10.21)
110
- mutant-license!
111
- mutant-rspec (~> 0.10.21)
112
- rake (>= 10.0)
113
- rspec (~> 3.6)
114
- ruby_event_store!
115
- ruby_event_store-rspec!
116
-
117
- BUNDLED WITH
118
- 2.2.27
data/Makefile DELETED
@@ -1,21 +0,0 @@
1
- GEM_VERSION = $(shell cat ../RES_VERSION)
2
- GEM_NAME = ruby_event_store-rspec
3
- REQUIRE = ruby_event_store/rspec
4
- IGNORE = RubyEventStore::RSpec::Matchers\#differ \
5
- RubyEventStore::RSpec::Matchers\#formatter \
6
- RubyEventStore::RSpec::Matchers\#have_published \
7
- RubyEventStore::RSpec::Matchers\#have_applied \
8
- RubyEventStore::RSpec::Matchers\#have_subscribed_to_events \
9
- RubyEventStore::RSpec::Matchers\#publish \
10
- RubyEventStore::RSpec::Matchers\#be_an_event \
11
- RubyEventStore::RSpec::Publish\#last_event \
12
- RubyEventStore::RSpec::Matchers::ListPhraser.all_but_last
13
-
14
- SUBJECT ?= RubyEventStore::RSpec*
15
- DATABASE_URL ?= sqlite3::memory:
16
-
17
- include ../support/make/install.mk
18
- include ../support/make/test.mk
19
- include ../support/make/mutant.mk
20
- include ../support/make/gem.mk
21
- include ../support/make/help.mk
@@ -1,13 +0,0 @@
1
- require 'ruby_event_store/rspec'
2
-
3
- warn <<~EOW
4
- The 'rails_event_store-rspec' gem has been renamed.
5
-
6
- Please change your Gemfile or gemspec
7
- to reflect its new name:
8
-
9
- 'ruby_event_store-rspec'
10
-
11
- EOW
12
-
13
- RailsEventStore::RSpec = RubyEventStore::RSpec
@@ -1,36 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'rails_event_store-rspec'
7
- spec.version = '2.0.1'
8
- spec.licenses = ['MIT']
9
- spec.authors = ['Arkency']
10
- spec.email = ['dev@arkency.com']
11
-
12
- spec.summary = %q{RSpec matchers for RailsEventStore}
13
- spec.homepage = 'https://railseventstore.org'
14
- spec.metadata = {
15
- "homepage_uri" => "https://railseventstore.org/",
16
- "changelog_uri" => "https://github.com/RailsEventStore/rails_event_store/releases",
17
- "source_code_uri" => "https://github.com/RailsEventStore/rails_event_store",
18
- "bug_tracker_uri" => "https://github.com/RailsEventStore/rails_event_store/issues",
19
- }
20
-
21
- spec.files = ['lib/rails_event_store/rspec.rb']
22
- spec.require_paths = ['lib']
23
-
24
- spec.add_runtime_dependency 'rspec', '~> 3.0'
25
- spec.add_runtime_dependency 'ruby_event_store-rspec', '= 2.0.3'
26
-
27
- spec.post_install_message = <<~EOW
28
- The 'rails_event_store-rspec' gem has been renamed.
29
-
30
- Please change your Gemfile or gemspec
31
- to reflect its new name:
32
-
33
- 'ruby_event_store-rspec'
34
-
35
- EOW
36
- end
@@ -1,26 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'ruby_event_store/rspec/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'ruby_event_store-rspec'
8
- spec.version = RubyEventStore::RSpec::VERSION
9
- spec.licenses = ['MIT']
10
- spec.authors = ['Arkency']
11
- spec.email = ['dev@arkency.com']
12
-
13
- spec.summary = %q{RSpec matchers for RailsEventStore}
14
- spec.homepage = 'https://railseventstore.org'
15
- spec.metadata = {
16
- "homepage_uri" => "https://railseventstore.org/",
17
- "changelog_uri" => "https://github.com/RailsEventStore/rails_event_store/releases",
18
- "source_code_uri" => "https://github.com/RailsEventStore/rails_event_store",
19
- "bug_tracker_uri" => "https://github.com/RailsEventStore/rails_event_store/issues",
20
- }
21
-
22
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test/|spec/|features/|.mutant.yml)}) }
23
- spec.require_paths = ['lib']
24
-
25
- spec.add_runtime_dependency 'rspec', '~> 3.0'
26
- end