spec/acceptance/rest/channel_spec.rb in ably-1.1.0 vs spec/acceptance/rest/channel_spec.rb in ably-1.1.1
- old
+ new
@@ -273,9 +273,46 @@
channel.publish('foo')
expect(get_stub).to have_been_requested
end
end
end
+
+ context 'with a frozen message event name' do
+ let(:event_name) { random_str.freeze }
+
+ it 'succeeds and publishes with an implicit client_id' do
+ channel.publish([name: event_name])
+ channel.publish(event_name)
+
+ if !(RUBY_VERSION.match(/^1\./) || RUBY_VERSION.match(/^2\.[012]/))
+ channel.publish(+'foo-bar') # new style freeze, see https://github.com/ably/ably-ruby/issues/132
+ else
+ channel.publish('foo-bar'.freeze) # new + style not supported until Ruby 2.3
+ end
+
+ channel.history do |messages|
+ expect(messages.length).to eql(3)
+ expect(messages.first.name).to eql(event_name)
+ expect(messages[1].name).to eql(event_name)
+ expect(messages.last.name).to eql('foo-bar')
+ end
+ end
+ end
+
+ context 'with a frozen payload' do
+ let(:payload) { { foo: random_str.freeze }.freeze }
+
+ it 'succeeds and publishes with an implicit client_id' do
+ channel.publish([data: payload])
+ channel.publish(nil, payload)
+
+ channel.history do |messages|
+ expect(messages.length).to eql(2)
+ expect(messages.first.data).to eql(payload)
+ expect(messages.last.data).to eql(payload)
+ end
+ end
+ end
end
describe '#history' do
let(:channel) { client.channel("persisted:#{random_str(4)}") }
let(:expected_history) do