Sha256: ca2b8a0afffdc879c6674ec931de73f639534420414a9e52d317e2779662a38e

Contents?: true

Size: 606 Bytes

Versions: 7

Compression:

Stored size: 606 Bytes

Contents

require 'bundler/setup'
dir = File.expand_path(File.dirname(__FILE__))
require dir + '/../lib/faye'
require dir + '/../vendor/em-rspec/lib/em-rspec'
require 'rack/test'

module EncodingHelper
  def encode(message)
    message.respond_to?(:force_encoding) ?
        message.force_encoding("UTF-8") :
        message
  end
  
  def bytes(string)
    count = string.respond_to?(:bytes) ? string.bytes.count : string.size
    (0...count).map do |i|
      string.respond_to?(:getbyte) ? string.getbyte(i) : string[i]
    end
  end
  
  def parse(bytes)
    @parser.parse(bytes.map { |b| b.chr } * '')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
faye-0.7.2 spec/spec_helper.rb
faye-0.6.8 spec/spec_helper.rb
faye-0.7.1 spec/spec_helper.rb
faye-0.7.0 spec/spec_helper.rb
faye-0.6.7 spec/spec_helper.rb
faye-0.6.6 spec/spec_helper.rb
faye-0.6.5 spec/spec_helper.rb