Sha256: 3b584413867bb5f73f00596b9ba7067b40a7191cc00566e494237d5a133c2b24

Contents?: true

Size: 1.57 KB

Versions: 14

Compression:

Stored size: 1.57 KB

Contents

require File.dirname(__FILE__) + "/../spec_helper"

# Tests the behaviour of the AbstractClient functionality
# via a thin wrapper of the class via Marvin::TestClient.

describe "the base Marvin::TestClient functionality" do
  
  it "should dispatch :client_connected as the first event on process_connect" do
    client(true).dispatched_events.should == []
    client.process_connect
    client.dispatched_events.first.should == [:client_connected, {}]
  end
  
  it "should dispatch :client_connected as the first event on process_connect" do
    client(true).dispatched_events.should == []
    client.process_connect
    Marvin::Logger.info client.outgoing_commands.inspect
    client.dispatched_events[-2].first.should == :outgoing_nick
    client.dispatched_events[-1].first.should == :outgoing_join
    client.outgoing_commands.length.should == 3
    client.outgoing_commands[0].should =~ /^USER \w+ 0 \* :\w+ \r\n$/
    client.outgoing_commands[1].should =~ /^NICK \w+ \r\n$/
    client.outgoing_commands[2].should =~ /^JOIN \#[A-Za-z0-9\-\_]+ \r\n$/
  end
  
  it "should dispatch :client_disconnect on process_disconnect" do
    client(true).dispatched_events.should == []
    client.process_disconnect
    client.dispatched_events.last.should == [:client_disconnected, {}]
  end
  
  it "should add an :incoming_line event for each incoming line" do
    client(true).dispatched_events.should == []
    client.receive_line "SOME RANDOM LINE THAT HAS ZERO ACTUAL USE"
    client.dispatched_events.first.should == [:incoming_line, {:line => "SOME RANDOM LINE THAT HAS ZERO ACTUAL USE"}]
  end
  
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
Sutto-marvin-0.1.20081115 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.1.20081120 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.2.0 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.2.1 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.2.2 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.2.3 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.2.4 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.3.0 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.3.2 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.3.3 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.3.4 spec/marvin/abstract_client_test.rb
Sutto-marvin-0.4.0 spec/marvin/abstract_client_test.rb
jeffrafter-marvin-0.1.20081115 spec/marvin/abstract_client_test.rb
jeffrafter-marvin-0.1.20081120 spec/marvin/abstract_client_test.rb