Sha256: 40b159097ba6da5fe33a8e49bca6de6c01829b20c36541f4d3bc4b73278b78b0

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

require 'test_helper'

class StatelessTest < Test::Unit::TestCase
  include JsChatHelpers

  def setup
    @jschat = JsChatMock.new
    @jschat.post_init
    @cookie = get_cookie 
  end

  def test_identify
    response = send_to_jschat({ 'identify' => 'alex', 'cookie' => @cookie })
    assert_equal 'identified', response['display']
  end

  def test_join
    response = identify_as 'alex2', '#jschat'
    assert JSON.parse(response)['join']
  end

  def test_message
    response = identify_as 'nick', '#jschat'
    assert send_to_jschat({ 'cookie' => @cookie, 'send' => 'hello', 'to' => '#jschat' }, false)
  end

  private

    def get_cookie
      JSON.parse(@jschat.receive_line({ 'protocol' => 'stateless' }.to_json))['cookie']
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jschat-0.3.7 test/stateless_test.rb