em-irc 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe EventMachine::IRC::Responses do
4
+ subject {EventMachine::IRC::Client.new}
5
+
6
+ def handle(raw_response)
7
+ parsed = subject.parse_message(raw_response)
8
+ subject.handle_parsed_message(parsed)
9
+ end
10
+
11
+ context 'ping' do
12
+ it 'should respond with pong' do
13
+ subject.should_receive(:pong).with("irc.net")
14
+ handle ":irc.net PING irc.net"
15
+ end
16
+ end
17
+
18
+ context 'privmsg' do
19
+ it 'should trigger message' do
20
+ subject.should_receive(:trigger).with(:message, 'sender', '#channel', 'full message')
21
+ handle ":sender!~sender@host PRIVMSG #channel :full message"
22
+ end
23
+ end
24
+
25
+ context 'join' do
26
+ it 'should trigger join' do
27
+ subject.should_receive(:trigger).with(:join, 'sender', '#channel')
28
+ handle ":sender!~sender@host JOIN #channel"
29
+ end
30
+ end
31
+
32
+ context 'rpl_welcome' do
33
+ it 'should set nick' do
34
+ subject.should_receive(:trigger).with(:nick, 'jessie')
35
+ handle ":irc.the.net 001 jessie :Welcome to the Internet Relay Network jessie!~jessie@localhost"
36
+ end
37
+ end
38
+
39
+ context 'err_nicknameinuse' do
40
+ it 'should unset nick' do
41
+ subject.instance_eval {@nick = 'jerry'}
42
+ handle ":irc.the.net 433 :ERR_NICKNAMEINUSE"
43
+ subject.nick.should be_nil
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-irc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-11 00:00:00.000000000 Z
12
+ date: 2012-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &70164206319840 !ruby/object:Gem::Requirement
16
+ requirement: &70311804512540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70164206319840
24
+ version_requirements: *70311804512540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70164206319260 !ruby/object:Gem::Requirement
27
+ requirement: &70311804512120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70164206319260
35
+ version_requirements: *70311804512120
36
36
  description: em-irc is an IRC client that uses EventMachine to handle connections
37
37
  to servers
38
38
  email:
@@ -55,8 +55,11 @@ files:
55
55
  - examples/logger.rb
56
56
  - lib/em-irc.rb
57
57
  - lib/em-irc/client.rb
58
+ - lib/em-irc/commands.rb
58
59
  - lib/em-irc/dispatcher.rb
60
+ - lib/em-irc/responses.rb
59
61
  - lib/em-irc/version.rb
62
+ - lib/support/dsl_accessor.rb
60
63
  - spec/config/gnutls-cert.pem
61
64
  - spec/config/gnutls-key.pem
62
65
  - spec/config/ngircd-encrypted-gnutls.conf
@@ -66,7 +69,9 @@ files:
66
69
  - spec/config/openssl-key.pem
67
70
  - spec/integration/integration_spec.rb
68
71
  - spec/lib/em-irc/client_spec.rb
72
+ - spec/lib/em-irc/commands_spec.rb
69
73
  - spec/lib/em-irc/dispatcher_spec.rb
74
+ - spec/lib/em-irc/responses_spec.rb
70
75
  - spec/spec_helper.rb
71
76
  homepage: http://github.com/jch/em-irc
72
77
  licenses: []
@@ -102,6 +107,8 @@ test_files:
102
107
  - spec/config/openssl-key.pem
103
108
  - spec/integration/integration_spec.rb
104
109
  - spec/lib/em-irc/client_spec.rb
110
+ - spec/lib/em-irc/commands_spec.rb
105
111
  - spec/lib/em-irc/dispatcher_spec.rb
112
+ - spec/lib/em-irc/responses_spec.rb
106
113
  - spec/spec_helper.rb
107
114
  has_rdoc: