Skip to content

Commit

Permalink
Make RubyEventStore#append return self instead of ok
Browse files Browse the repository at this point in the history
Issue: #392
  • Loading branch information
swistak35 committed Aug 1, 2018
1 parent ea9afb0 commit 75f71be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ruby_event_store/lib/ruby_event_store/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ def append_to_stream(events, stream_name: GLOBAL_STREAM, expected_version: :any)
# Persists new event(s) without notifying any subscribed handlers
#
# @param (see #publish)
# @return [:ok]
# @return [self]
def append(events, stream_name: GLOBAL_STREAM, expected_version: :any)
serialized_events = serialize_events(enrich_events_metadata(events))
append_to_stream_serialized_events(serialized_events, stream_name: stream_name, expected_version: expected_version)
:ok
self
end

# Links already persisted event(s) to a different stream.
Expand Down
6 changes: 3 additions & 3 deletions ruby_event_store/spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ module RubyEventStore
expect(client.publish(TestEvent.new)).to eq(:ok)
end

specify 'append returns :ok when success' do
expect(client.append(TestEvent.new, stream_name: stream)).to eq(:ok)
specify 'append returns client when success' do
expect(client.append(TestEvent.new, stream_name: stream)).to eq(client)
end

specify 'append to default stream when not specified' do
expect(client.append(test_event = TestEvent.new)).to eq(:ok)
expect(client.append(test_event = TestEvent.new)).to eq(client)
expect(client.read.limit(100).each.to_a).to eq([test_event])
end

Expand Down

0 comments on commit 75f71be

Please sign in to comment.