diff --git a/ruby_event_store/lib/ruby_event_store/specification.rb b/ruby_event_store/lib/ruby_event_store/specification.rb index 8c6fcaede3..d96a147b30 100644 --- a/ruby_event_store/lib/ruby_event_store/specification.rb +++ b/ruby_event_store/lib/ruby_event_store/specification.rb @@ -28,7 +28,6 @@ def stream(stream_name) # @return [Specification] def from(start) raise InvalidPageStart if start.nil? || start.empty? - raise EventNotFound.new(start) unless reader.has_event?(start) Specification.new(reader, result.dup { |r| r.start = start }) end @@ -39,7 +38,6 @@ def from(start) # @return [Specification] def to(stop) raise InvalidPageStop if stop.nil? || stop.empty? - raise EventNotFound.new(stop) unless reader.has_event?(stop) Specification.new(reader, result.dup { |r| r.stop = stop }) end diff --git a/ruby_event_store/lib/ruby_event_store/specification_reader.rb b/ruby_event_store/lib/ruby_event_store/specification_reader.rb index cdc23e8353..86e2816bb6 100644 --- a/ruby_event_store/lib/ruby_event_store/specification_reader.rb +++ b/ruby_event_store/lib/ruby_event_store/specification_reader.rb @@ -29,12 +29,6 @@ def count(specification_result) repository.count(specification_result) end - # @api private - # @private - def has_event?(event_id) - repository.has_event?(event_id) - end - private attr_reader :repository, :mapper diff --git a/ruby_event_store/spec/client_spec.rb b/ruby_event_store/spec/client_spec.rb index 277bed54a6..ab1974b39d 100644 --- a/ruby_event_store/spec/client_spec.rb +++ b/ruby_event_store/spec/client_spec.rb @@ -341,19 +341,6 @@ module RubyEventStore expect { client.read.backward.stream("").limit(100).to_a }.to raise_error(IncorrectStreamData) end - specify "raise exception if event_id does not exist" do - expect { client.read.stream("stream_name").from("0").limit(100).to_a }.to raise_error( - EventNotFound, - /Event not found: 0/ - ) - expect { client.read.backward.stream("stream_name").from("0").limit(100).to_a }.to raise_error(EventNotFound, /0/) - end - - specify "raise exception if event_id is not given or invalid" do - expect { client.read.stream("stream_name").from(nil).limit(100).to_a }.to raise_error(InvalidPageStart) - expect { client.read.backward.stream("stream_name").from(:invalid).limit(100).to_a }.to raise_error(EventNotFound) - end - specify "fails when page size is invalid" do expect { client.read.stream("stream_name").limit(0).to_a }.to raise_error(InvalidPageSize) expect { client.read.backward.stream("stream_name").limit(0).to_a }.to raise_error(InvalidPageSize) @@ -410,9 +397,11 @@ module RubyEventStore client.publish(event, stream_name: "stream_name") end - expect { client.read.stream("stream_name").from(SecureRandom.uuid).limit(100).to_a }.to raise_error(EventNotFound) + expect { client.read.stream("stream_name").from(SecureRandom.uuid).limit(100).to_a }.to raise_error( + EventNotFoundInStream + ) expect { client.read.backward.stream("stream_name").from(SecureRandom.uuid).limit(100).to_a }.to raise_error( - EventNotFound + EventNotFoundInStream ) end diff --git a/ruby_event_store/spec/specification_spec.rb b/ruby_event_store/spec/specification_spec.rb index 38490e71a0..42f57b2a4f 100644 --- a/ruby_event_store/spec/specification_spec.rb +++ b/ruby_event_store/spec/specification_spec.rb @@ -38,8 +38,6 @@ module RubyEventStore specify { expect { specification.from(nil) }.to raise_error(InvalidPageStart) } specify { expect { specification.from("") }.to raise_error(InvalidPageStart) } - specify { expect { specification.from(:dummy) }.to raise_error(EventNotFound, /dummy/) } - specify { expect { specification.from(none_such_id) }.to raise_error(EventNotFound, /#{none_such_id}/) } specify do repository.append_to_stream([test_record(event_id)], Stream.new("Dummy"), ExpectedVersion.none) expect { specification.stream('Another').from(event_id) }.not_to raise_error @@ -47,12 +45,6 @@ module RubyEventStore specify { expect { specification.to(nil) }.to raise_error(InvalidPageStop) } specify { expect { specification.to("") }.to raise_error(InvalidPageStop) } - specify { expect { specification.to(:dummy) }.to raise_error(EventNotFound, /dummy/) } - specify { expect { specification.to(none_such_id) }.to raise_error(EventNotFound, /#{none_such_id}/) } - specify do - repository.append_to_stream([test_record(event_id)], Stream.new("Dummy"), ExpectedVersion.none) - expect { specification.stream('Another').to(event_id) }.not_to raise_error - end specify { expect { specification.older_than(nil) }.to raise_error(ArgumentError) } specify { expect { specification.older_than("") }.to raise_error(ArgumentError) }