File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
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 . nil ?
25+ def with_types? = !with_types . empty ?
2626 def forward? = direction . equal? ( :forward )
2727 def backward? = direction . equal? ( :backward )
2828 def batched? = read_as . equal? ( :batch )
@@ -53,7 +53,7 @@ def initialize(
5353 read_as : :all ,
5454 batch_size : DEFAULT_BATCH_SIZE ,
5555 with_ids : nil ,
56- with_types : nil ,
56+ with_types : [ ] ,
5757 )
5858 )
5959 @reader = reader
@@ -313,8 +313,7 @@ def last
313313 # @types [Class, Array(Class)] types of event to look for.
314314 # @return [Specification]
315315 def of_type ( *types )
316- types_ = types . flatten . map ( &:to_s ) unless types . empty?
317- Specification . new ( reader , result . with ( with_types : types_ ) )
316+ Specification . new ( reader , result . with ( with_types : types . flatten . map ( &:to_s ) ) )
318317 end
319318 alias of_types of_type
320319
Original file line number Diff line number Diff line change @@ -67,8 +67,8 @@ module RubyEventStore
6767 specify { expect ( specification . with_id ( [ event_id ] ) . result . with_ids? ) . to be ( true ) }
6868 specify { expect ( specification . with_id ( [ ] ) . result . with_ids? ) . to be ( true ) }
6969
70- specify { expect ( specification . result . with_types ) . to be_nil }
71- specify { expect ( specification . of_type . result . with_types ) . to be_nil }
70+ specify { expect ( specification . result . with_types ) . to eq ( [ ] ) }
71+ specify { expect ( specification . of_type . result . with_types ) . to eq ( [ ] ) }
7272 specify { expect ( specification . of_type ( [ TestEvent ] ) . result . with_types ) . to eq ( [ "TestEvent" ] ) }
7373 specify { expect ( specification . result . with_types? ) . to be ( false ) }
7474 specify { expect ( specification . of_type ( [ TestEvent ] ) . result . with_types? ) . to be ( true ) }
You can’t perform that action at this time.
0 commit comments