Skip to content

Commit d416053

Browse files
committed
no valid_at storage optimization when different from created_at
1 parent 98b654d commit d416053

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

contrib/ruby_event_store-sequel/spec/event_repository_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,27 @@ module Sequel
111111
expect(event_record[:valid_at]).to be_nil
112112
end
113113

114+
specify "no valid-at storage optimization when different from created-at" do
115+
repository.append_to_stream(
116+
[
117+
SRecord.new(
118+
timestamp: t1 = with_precision(Time.at(0)),
119+
valid_at: t2 = with_precision(Time.at(1))
120+
)
121+
],
122+
Stream.new(GLOBAL_STREAM),
123+
ExpectedVersion.any
124+
)
125+
record = repository.read(specification.result).first
126+
expect(record.timestamp).to eq(t1)
127+
expect(record.valid_at).to eq(t2)
128+
129+
event_record = helper.sequel[:event_store_events].where(event_id: record.event_id).first
130+
expect(event_record[:created_at]).to eq(t1)
131+
expect(event_record[:valid_at]).to eq(t2)
132+
end
133+
134+
114135
private
115136

116137
def with_precision(time)

0 commit comments

Comments
 (0)