diff --git a/lib/ably/models/protocol_message.rb b/lib/ably/models/protocol_message.rb index 0088fded..19ac1662 100644 --- a/lib/ably/models/protocol_message.rb +++ b/lib/ably/models/protocol_message.rb @@ -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 diff --git a/spec/unit/models/protocol_message_spec.rb b/spec/unit/models/protocol_message_spec.rb index b279b3c5..32c74cbc 100644 --- a/spec/unit/models/protocol_message_spec.rb +++ b/spec/unit/models/protocol_message_spec.rb @@ -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) }) }