File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class Specification
2222 ) do
2323 def limit? = !limit . infinite?
2424 def with_ids? = !with_ids . nil?
25- def with_types? = !( with_types || [ ] ) . empty ?
25+ def with_types? = !with_types . nil ?
2626 def forward? = direction . equal? ( :forward )
2727 def backward? = direction . equal? ( :backward )
2828 def batched? = read_as . equal? ( :batch )
@@ -313,7 +313,8 @@ def last
313313 # @types [Class, Array(Class)] types of event to look for.
314314 # @return [Specification]
315315 def of_type ( *types )
316- Specification . new ( reader , result . with ( with_types : types . flatten . map ( &:to_s ) ) )
316+ types_ = types . flatten . map ( &:to_s ) unless types . empty?
317+ Specification . new ( reader , result . with ( with_types : types_ ) )
317318 end
318319 alias of_types of_type
319320
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ module RubyEventStore
6868 specify { expect ( specification . with_id ( [ ] ) . result . with_ids? ) . to be ( true ) }
6969
7070 specify { expect ( specification . result . with_types ) . to be_nil }
71+ specify { expect ( specification . of_type . result . with_types ) . to be_nil }
7172 specify { expect ( specification . of_type ( [ TestEvent ] ) . result . with_types ) . to eq ( [ "TestEvent" ] ) }
7273 specify { expect ( specification . result . with_types? ) . to be ( false ) }
7374 specify { expect ( specification . of_type ( [ TestEvent ] ) . result . with_types? ) . to be ( true ) }
You can’t perform that action at this time.
0 commit comments