Sha256: d38ee94268d0854c2bd9ed454861ed19744844bd379fa94e2d40e2c5974ba43f

Contents?: true

Size: 746 Bytes

Versions: 19

Compression:

Stored size: 746 Bytes

Contents

require 'test_helper'

class TestJsChat < 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

19 entries across 19 versions & 1 rubygems

Version Path
jschat-0.3.6 test/stateless_test.rb
jschat-0.3.5 test/stateless_test.rb
jschat-0.3.3 test/stateless_test.rb
jschat-0.3.2 test/stateless_test.rb
jschat-0.3.1 test/stateless_test.rb
jschat-0.3.0 test/stateless_test.rb
jschat-0.2.9 test/stateless_test.rb
jschat-0.2.8 test/stateless_test.rb
jschat-0.2.7 test/stateless_test.rb
jschat-0.2.6 test/stateless_test.rb
jschat-0.2.5 test/stateless_test.rb
jschat-0.2.4 test/stateless_test.rb
jschat-0.2.3 test/stateless_test.rb
jschat-0.2.2 test/stateless_test.rb
jschat-0.2.1 test/stateless_test.rb
jschat-0.2.0 test/stateless_test.rb
jschat-0.1.5 test/stateless_test.rb
jschat-0.1.2 test/stateless_test.rb
jschat-0.1.1 test/stateless_test.rb