Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECO-4970] Remove check for msg_serial when converting protocol message to JSON #437

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/ably/models/protocol_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ def attributes
# Return a JSON ready object from the underlying #attributes using Ably naming conventions for keys
def as_json(*args)
raise TypeError, ':action is missing, cannot generate a valid Hash for ProtocolMessage' unless action
raise TypeError, ':msg_serial is missing, cannot generate a valid Hash for ProtocolMessage' if ack_required? && !has_message_serial?

attributes.dup.tap do |hash_object|
hash_object['action'] = action.to_i
Expand Down
8 changes: 0 additions & 8 deletions spec/unit/models/protocol_message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,6 @@ def new_protocol_message(options)
end
end

context 'with missing msg_serial for ack message' do
let(:model) { new_protocol_message({ :action => message_action }) }

it 'it raises an exception' do
expect { model.to_json }.to raise_error TypeError, /msg_serial.*missing/
end
end

context 'is aliased by #to_s' do
let(:model) { new_protocol_message({ :action => attached_action, :channelSerial => 'unique', messages: [message1, message2, message3], :timestamp => as_since_epoch(Time.now) }) }

Expand Down
Loading