Skip to content

Commit 488642f

Browse files
pjurewiczfidel
authored andcommitted
cover current behaviour with a test
Currently, when we build specification to read events starting from a specific one, We do check if this event exists in a repository, but do not check if It exists in the stream we are scoping the query to. I want to simply protect this behavior for this moment.
1 parent 5b1d38d commit 488642f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ruby_event_store/spec/specification_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@ module RubyEventStore
4040
specify { expect { specification.from("") }.to raise_error(InvalidPageStart) }
4141
specify { expect { specification.from(:dummy) }.to raise_error(EventNotFound, /dummy/) }
4242
specify { expect { specification.from(none_such_id) }.to raise_error(EventNotFound, /#{none_such_id}/) }
43+
specify do
44+
repository.append_to_stream([test_record(event_id)], Stream.new("Dummy"), ExpectedVersion.none)
45+
expect { specification.stream('Another').from(event_id) }.not_to raise_error
46+
end
4347

4448
specify { expect { specification.to(nil) }.to raise_error(InvalidPageStop) }
4549
specify { expect { specification.to("") }.to raise_error(InvalidPageStop) }
4650
specify { expect { specification.to(:dummy) }.to raise_error(EventNotFound, /dummy/) }
4751
specify { expect { specification.to(none_such_id) }.to raise_error(EventNotFound, /#{none_such_id}/) }
52+
specify do
53+
repository.append_to_stream([test_record(event_id)], Stream.new("Dummy"), ExpectedVersion.none)
54+
expect { specification.stream('Another').to(event_id) }.not_to raise_error
55+
end
4856

4957
specify { expect { specification.older_than(nil) }.to raise_error(ArgumentError) }
5058
specify { expect { specification.older_than("") }.to raise_error(ArgumentError) }

0 commit comments

Comments
 (0)