spec/blather/stream/component_spec.rb in blather-0.3.0 vs spec/blather/stream/component_spec.rb in blather-0.3.1

- old
+ new

@@ -9,11 +9,11 @@ end end def mocked_server(times = nil, &block) @client ||= mock() - @client.stubs(:stopped) unless @client.respond_to?(:stopped) + @client.stubs(:unbind) unless @client.respond_to?(:unbind) @client.stubs(:jid=) unless @client.respond_to?(:jid=) MockServer.any_instance.expects(:receive_data).send(*(times ? [:times, times] : [:at_least, 1])).with &block EventMachine::run { # Mocked server @@ -58,11 +58,11 @@ it 'starts the stream once the connection is complete' do mocked_server(1) { |val, _| EM.stop; val.must_match(/stream:stream/) } end it 'sends stanzas to the client when the stream is ready' do - @client = mock(:stream_started) - @client.expects(:call).with do |n| + @client = mock(:post_init) + @client.expects(:receive_data).with do |n| EM.stop n.kind_of?(Stanza::Message) && @stream.ready?.must_equal(true) end state = nil