julien51-babylon 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/babylon.rb +5 -0
- data/lib/babylon/base/stanza.rb +0 -2
- data/lib/babylon/client_connection.rb +8 -11
- data/lib/babylon/component_connection.rb +4 -5
- data/lib/babylon/generator.rb +0 -2
- data/lib/babylon/runner.rb +3 -1
- data/lib/babylon/xmpp_parser.rb +1 -1
- data/spec/bin/babylon_spec.rb +0 -0
- data/spec/em_mock.rb +42 -0
- data/spec/lib/babylon/base/controller_spec.rb +205 -0
- data/spec/lib/babylon/base/stanza_spec.rb +15 -0
- data/spec/lib/babylon/base/view_spec.rb +64 -0
- data/spec/lib/babylon/client_connection_spec.rb +304 -0
- data/spec/lib/babylon/component_connection_spec.rb +135 -0
- data/spec/lib/babylon/generator_spec.rb +10 -0
- data/spec/lib/babylon/router/dsl_spec.rb +72 -0
- data/spec/lib/babylon/router_spec.rb +179 -0
- data/spec/lib/babylon/runner_spec.rb +213 -0
- data/spec/lib/babylon/xmpp_connection_spec.rb +222 -0
- data/spec/lib/babylon/xmpp_parser_spec.rb +268 -0
- data/spec/lib/babylon/xpath_helper_spec.rb +25 -0
- data/spec/spec_helper.rb +34 -0
- data/templates/babylon/config/dependencies.rb +0 -1
- data/test/babylon_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +34 -15
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Babylon::XpathHelper do
|
4
|
+
describe "namespace method" do
|
5
|
+
before do
|
6
|
+
@doc = Nokogiri::XML(<<-eoxml)
|
7
|
+
<iq from='me@my.jid/Eee' to='component.my.jid'
|
8
|
+
xml:lang='en' type='get' id='43'><query
|
9
|
+
xmlns='http://jabber.org/protocol/disco#info'/></iq>
|
10
|
+
eoxml
|
11
|
+
end
|
12
|
+
|
13
|
+
it "matches nodes of the given name with the given namespace URI" do
|
14
|
+
@doc.xpath("//iq/*[namespace(., 'query', 'http://jabber.org/protocol/disco#info')]", Babylon::XpathHelper.new).length.should == 1
|
15
|
+
end
|
16
|
+
|
17
|
+
it "does not match a namespace URI if the node names differ" do
|
18
|
+
@doc.xpath("//iq/*[namespace(., 'que', 'http://jabber.org/protocol/disco#info')]", Babylon::XpathHelper.new).length.should == 0
|
19
|
+
end
|
20
|
+
|
21
|
+
it "does not match a node if the namespace URIs differ" do
|
22
|
+
@doc.xpath("//iq/*[namespace(., 'query', 'http://jabber.org/protocol/disco#inf')]", Babylon::XpathHelper.new).length.should == 0
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../lib/babylon"
|
2
|
+
|
3
|
+
# #
|
4
|
+
# Deactivate the logging
|
5
|
+
Babylon.logger.level = Log4r::FATAL
|
6
|
+
|
7
|
+
Babylon.environment = "test"
|
8
|
+
|
9
|
+
if !defined? BabylonSpecHelper
|
10
|
+
module BabylonSpecHelper
|
11
|
+
##
|
12
|
+
# Load configuration from a local config file
|
13
|
+
def babylon_config
|
14
|
+
@config ||= YAML.load(File.read(File.join(File.dirname(__FILE__), "config.yaml")))
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
# Mock for Handler
|
19
|
+
def handler_mock
|
20
|
+
@handler_mock ||=
|
21
|
+
begin
|
22
|
+
mock(Object, { :on_connected => Proc.new { |conn|
|
23
|
+
},
|
24
|
+
:on_disconnected => Proc.new {
|
25
|
+
# Disconnected
|
26
|
+
},
|
27
|
+
:on_stanza => Proc.new { |stanza|
|
28
|
+
# Stanza!
|
29
|
+
}
|
30
|
+
})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class BabylonTest < Test::Unit::TestCase
|
4
|
+
# Tests are done through Rspec... but feel free to add any Unit tests you think might be helpful to understand and fix code more easily
|
5
|
+
should "probably rename this file and start testing for real" do
|
6
|
+
end
|
7
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: julien51-babylon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- julien Genestoux
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-23 00:00:00 -07:00
|
13
13
|
default_executable: babylon
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -20,43 +20,42 @@ executables:
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
-
- README.rdoc
|
24
23
|
- LICENSE
|
24
|
+
- README.rdoc
|
25
25
|
files:
|
26
|
+
- LICENSE
|
27
|
+
- README.rdoc
|
28
|
+
- Rakefile
|
26
29
|
- bin/babylon
|
27
30
|
- lib/babylon.rb
|
28
31
|
- lib/babylon/base/controller.rb
|
29
|
-
- lib/babylon/base/view.rb
|
30
32
|
- lib/babylon/base/stanza.rb
|
33
|
+
- lib/babylon/base/view.rb
|
31
34
|
- lib/babylon/client_connection.rb
|
32
35
|
- lib/babylon/component_connection.rb
|
33
|
-
- lib/babylon/
|
36
|
+
- lib/babylon/generator.rb
|
34
37
|
- lib/babylon/router.rb
|
38
|
+
- lib/babylon/router/dsl.rb
|
35
39
|
- lib/babylon/runner.rb
|
36
|
-
- lib/babylon/generator.rb
|
37
40
|
- lib/babylon/xmpp_connection.rb
|
38
41
|
- lib/babylon/xmpp_parser.rb
|
39
42
|
- lib/babylon/xpath_helper.rb
|
40
|
-
- LICENSE
|
41
|
-
- Rakefile
|
42
|
-
- README.rdoc
|
43
43
|
- templates/babylon/app/controllers/controller.rb
|
44
|
-
- templates/babylon/app/views/view.rb
|
45
44
|
- templates/babylon/app/stanzas/stanza.rb
|
45
|
+
- templates/babylon/app/views/view.rb
|
46
46
|
- templates/babylon/config/boot.rb
|
47
47
|
- templates/babylon/config/config.yaml
|
48
48
|
- templates/babylon/config/dependencies.rb
|
49
49
|
- templates/babylon/config/routes.rb
|
50
|
-
- templates/babylon/script/component
|
51
|
-
- templates/babylon/log/test.log
|
52
50
|
- templates/babylon/log/development.log
|
53
51
|
- templates/babylon/log/production.log
|
52
|
+
- templates/babylon/log/test.log
|
53
|
+
- templates/babylon/script/component
|
54
54
|
- templates/babylon/tmp/pids/README
|
55
55
|
has_rdoc: true
|
56
56
|
homepage: http://github.com/julien51/babylon
|
57
57
|
post_install_message:
|
58
58
|
rdoc_options:
|
59
|
-
- --inline-source
|
60
59
|
- --charset=UTF-8
|
61
60
|
require_paths:
|
62
61
|
- lib
|
@@ -81,10 +80,30 @@ requirements:
|
|
81
80
|
- sax-machine
|
82
81
|
- templater
|
83
82
|
- daemons
|
83
|
+
- optparse
|
84
|
+
- digest/sha1
|
85
|
+
- base64
|
86
|
+
- resolv
|
84
87
|
rubyforge_project: babylon
|
85
88
|
rubygems_version: 1.2.0
|
86
89
|
signing_key:
|
87
90
|
specification_version: 2
|
88
91
|
summary: Babylon is a framework to create EventMachine based XMPP External Components in Ruby.
|
89
|
-
test_files:
|
90
|
-
|
92
|
+
test_files:
|
93
|
+
- spec/bin/babylon_spec.rb
|
94
|
+
- spec/em_mock.rb
|
95
|
+
- spec/lib/babylon/base/controller_spec.rb
|
96
|
+
- spec/lib/babylon/base/stanza_spec.rb
|
97
|
+
- spec/lib/babylon/base/view_spec.rb
|
98
|
+
- spec/lib/babylon/client_connection_spec.rb
|
99
|
+
- spec/lib/babylon/component_connection_spec.rb
|
100
|
+
- spec/lib/babylon/generator_spec.rb
|
101
|
+
- spec/lib/babylon/router/dsl_spec.rb
|
102
|
+
- spec/lib/babylon/router_spec.rb
|
103
|
+
- spec/lib/babylon/runner_spec.rb
|
104
|
+
- spec/lib/babylon/xmpp_connection_spec.rb
|
105
|
+
- spec/lib/babylon/xmpp_parser_spec.rb
|
106
|
+
- spec/lib/babylon/xpath_helper_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
- test/babylon_test.rb
|
109
|
+
- test/test_helper.rb
|