spec/rubyfit/message_writer_spec.rb
def check_bytes(bytes, expected_fields, leftover = 0)
    expected_fields.each do |field, expected|
      expected = Array(expected)
      value = bytes.shift(expected.size)
      expect(value).to eq(expected), "Expected '#{field}'\n  to be: #{expected.inspect}\nbut got: #{value.inspect}"
    end
    expect(bytes.length).to eq(leftover)
  end
# check_bytes takes a byte array and an ordered hash of field name
# (informational only) to expected byte array. For each field, the byte array
# is shifted by the size of the expected value for the field, and the values
# are compared. Finally, the length of the byte array is checked to equal the
# leftover parameter (default 0).
check_bytes takes a byte array and an ordered hash of field name
(informational only) to expected byte array. For each field, the byte array
is shifted by the size of the expected value for the field, and the values
are compared. Finally, the length of the byte array is checked to equal the
leftover parameter (default 0).
check_bytes takes a byte array and an ordered hash of field name ( informational only ) to expected byte array . For each field the byte array is shifted by the size of the expected value for the field and the values are compared . Finally the length of the byte array is checked to equal the leftover parameter ( default 0 ) .
def check_bytes(bytes, expected_fields, leftover = 0)
    expected_fields.each do |field, expected|
      expected = Array(expected)
      value = bytes.shift(expected.size)
      expect(value).to eq(expected), "Expected '#{field}'\n  to be: #{expected.inspect}\nbut got: #{value.inspect}"
    end
    expect(bytes.length).to eq(leftover)
  end
def check_bytes ( bytes , expected_fields , leftover = 0 ) expected_fields . each do | field , expected | expected = Array ( expected ) value = bytes . shift ( expected . size ) expect ( value ) . to eq ( expected ) , "Expected '#{field}'\n  to be: #{expected.inspect}\nbut got: #{value.inspect}" end expect ( bytes . length ) . to eq ( leftover ) end
check_bytes takes a byte array and an ordered hash of field name
(informational only) to expected byte array.
check_bytes takes a byte array and an ordered hash of field name ( informational only ) to expected byte array .
bytes
expected_fields
leftover