Sha256: a80be339455b026d76ce8a702d53826651cc423f5e601635a4001439e361e99b

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

shared_examples_for 'valid_incoming_frame' do
  let(:decoded_text_array) { decoded_text == "" ? [""] : Array(decoded_text) } # Bug in Ruby 1.8 -> Array("") => [] instead of [""]
  let(:frame_type_array) { Array(frame_type) }

  its(:class) { should eql(WebSocket::Frame::Incoming) }
  its(:data) { should eql(encoded_text || "") }
  its(:version) { should eql(version) }
  its(:type) { should be_nil }
  its(:decoded?) { should be_false }
  its(:to_s) { should eql(encoded_text || "") }

  it "should have specified number of returned frames" do
    decoded_text_array.each_with_index do |da, index|
      n = subject.next
      n.should_not be_nil, "Should return frame for #{da}, #{frame_type_array[index]}"
      n.class.should eql(WebSocket::Frame::Incoming), "Should be WebSocket::Frame::Incoming, #{n} received instead"
    end
    subject.next.should be_nil
    subject.error.should eql(error)
  end

  it "should return valid decoded frame for each specified decoded texts" do
    decoded_text_array.each_with_index do |da, index|
      f = subject.next
      f.decoded?.should be_true
      f.type.should eql(frame_type_array[index])
      f.to_s.should eql(da)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
websocket-1.0.7 spec/support/incoming_frames.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/websocket-1.0.6/spec/support/incoming_frames.rb
websocket-1.0.6 spec/support/incoming_frames.rb
websocket-1.0.5 spec/support/incoming_frames.rb
websocket-1.0.4 spec/support/incoming_frames.rb
websocket-1.0.3 spec/support/incoming_frames.rb
websocket-1.0.2 spec/support/incoming_frames.rb
websocket-1.0.1 spec/support/incoming_frames.rb
websocket-1.0.0 spec/support/incoming_frames.rb