librevox 0.2.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- require 'spec/helper'
1
+ require './spec/helper'
2
2
  require 'librevox/commands'
3
3
 
4
4
  module CommandTest
@@ -6,18 +6,17 @@ module CommandTest
6
6
 
7
7
  extend self
8
8
 
9
- def execute_cmd(name, args="", &block)
9
+ def command name, args=""
10
10
  {
11
11
  :name => name,
12
- :args => args,
13
- :block => block
12
+ :args => args
14
13
  }
15
14
  end
16
15
  end
17
16
 
18
- describe Librevox::Commands do
19
- C = CommandTest
17
+ C = CommandTest
20
18
 
19
+ describe Librevox::Commands do
21
20
  should "status" do
22
21
  cmd = C.status
23
22
  cmd[:name].should == "status"
@@ -65,4 +64,40 @@ describe Librevox::Commands do
65
64
  cmd[:name].should == "hupall"
66
65
  cmd[:args].should == "some_cause"
67
66
  end
67
+
68
+ describe "hash" do
69
+ should "insert" do
70
+ cmd = C.hash :insert, :firmafon, :foo, "some value or other"
71
+ cmd[:name].should == "hash"
72
+ cmd[:args].should == "insert/firmafon/foo/some value or other"
73
+ end
74
+
75
+ should "select" do
76
+ cmd = C.hash :select, :firmafon, :foo
77
+ cmd[:name].should == "hash"
78
+ cmd[:args].should == "select/firmafon/foo"
79
+ end
80
+
81
+ should "delete" do
82
+ cmd = C.hash :delete, :firmafon, :foo
83
+ cmd[:name].should == "hash"
84
+ cmd[:args].should == "delete/firmafon/foo"
85
+ end
86
+ end
87
+
88
+ describe "uuid_park" do
89
+ should "park" do
90
+ cmd = C.uuid_park "1234-abcd"
91
+ cmd[:name].should == "uuid_park"
92
+ cmd[:args].should == "1234-abcd"
93
+ end
94
+ end
95
+
96
+ describe "uuid_bridge" do
97
+ should "bridge" do
98
+ cmd = C.uuid_bridge "1234-abcd", "9090-ffff"
99
+ cmd[:name].should == "uuid_bridge"
100
+ cmd[:args].should == "1234-abcd 9090-ffff"
101
+ end
102
+ end
68
103
  end
@@ -1,4 +1,4 @@
1
- require 'spec/helper'
1
+ require './spec/helper'
2
2
  require 'librevox/response'
3
3
 
4
4
  include Librevox
metadata CHANGED
@@ -1,7 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librevox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ version: "0.3"
5
9
  platform: ruby
6
10
  authors:
7
11
  - Harry Vangberg
@@ -9,10 +13,51 @@ autorequire:
9
13
  bindir: bin
10
14
  cert_chain: []
11
15
 
12
- date: 2010-02-09 00:00:00 +01:00
16
+ date: 2010-09-30 00:00:00 +02:00
13
17
  default_executable:
14
- dependencies: []
15
-
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: eventmachine
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 12
30
+ - 10
31
+ version: 0.12.10
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bacon
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 1
45
+ version: "1.1"
46
+ type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rr
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 1
58
+ version: "1"
59
+ type: :development
60
+ version_requirements: *id003
16
61
  description: |-
17
62
  EventMachine-based Ruby library for interacting with the
18
63
  open source telephony platform FreeSwitch.
@@ -37,6 +82,13 @@ files:
37
82
  - lib/librevox/listener/base.rb
38
83
  - lib/librevox/listener/inbound.rb
39
84
  - lib/librevox/listener/outbound.rb
85
+ - spec/helper.rb
86
+ - spec/librevox/listener.rb
87
+ - spec/librevox/spec_applications.rb
88
+ - spec/librevox/spec_commands.rb
89
+ - spec/librevox/spec_response.rb
90
+ - spec/librevox/listener/spec_inbound.rb
91
+ - spec/librevox/listener/spec_outbound.rb
40
92
  has_rdoc: true
41
93
  homepage: http://github.com/ichverstehe/librevox
42
94
  licenses: []
@@ -47,21 +99,25 @@ rdoc_options: []
47
99
  require_paths:
48
100
  - lib
49
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
50
103
  requirements:
51
104
  - - ">="
52
105
  - !ruby/object:Gem::Version
106
+ segments:
107
+ - 0
53
108
  version: "0"
54
- version:
55
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
56
111
  requirements:
57
112
  - - ">="
58
113
  - !ruby/object:Gem::Version
114
+ segments:
115
+ - 0
59
116
  version: "0"
60
- version:
61
117
  requirements: []
62
118
 
63
119
  rubyforge_project:
64
- rubygems_version: 1.3.5
120
+ rubygems_version: 1.3.7
65
121
  signing_key:
66
122
  specification_version: 3
67
123
  summary: Ruby library for interacting with FreeSWITCH.
@@ -69,7 +125,6 @@ test_files:
69
125
  - spec/helper.rb
70
126
  - spec/librevox/listener.rb
71
127
  - spec/librevox/spec_applications.rb
72
- - spec/librevox/spec_command_socket.rb
73
128
  - spec/librevox/spec_commands.rb
74
129
  - spec/librevox/spec_response.rb
75
130
  - spec/librevox/listener/spec_inbound.rb
@@ -1,111 +0,0 @@
1
- require 'spec/helper'
2
- require 'rr'
3
- require 'mocksocket'
4
-
5
- require 'librevox/command_socket'
6
-
7
- class Bacon::Context
8
- include RR::Adapters::RRMethods
9
- end
10
-
11
- module Librevox
12
- module Commands
13
- def sample_cmd(args="")
14
- execute_cmd "sample_cmd", args
15
- end
16
- end
17
- end
18
-
19
- describe Librevox::CommandSocket do
20
- before do
21
- @socket, @server = MockSocket.pipe
22
- stub(TCPSocket).open(anything, anything).times(any_times) {@socket}
23
-
24
- @server.print "Content-Type: command/reply\nReply-Text: +OK\n\n"
25
- end
26
-
27
- # This should be tested with some mocks. How do we use rr + bacon?
28
- describe ":connect => false" do
29
- should "not connect" do
30
- @cmd = Librevox::CommandSocket.new(:connect => false)
31
- @server.should.be.empty?
32
- end
33
-
34
- should "connect when asked" do
35
- @cmd.connect
36
- @server.gets.should == "auth ClueCon\n"
37
- end
38
- end
39
-
40
- describe "with auto-connect" do
41
- before do
42
- @cmd = Librevox::CommandSocket.new
43
- end
44
-
45
- should "authenticate" do
46
- @server.gets.should == "auth ClueCon\n"
47
- end
48
-
49
- should "read header response" do
50
- @server.print "Content-Type: command/reply\nSome-Header: Some value\n\n"
51
- reply = @cmd.run_cmd "foo"
52
-
53
- reply.class.should == Librevox::Response
54
- reply.headers[:some_header].should == "Some value"
55
- end
56
-
57
- should "read command/reply responses" do
58
- @server.print "Content-Type: api/log\nSome-Header: Old data\n\n"
59
-
60
- @server.print "Content-Type: command/reply\nSome-Header: New data\n\n"
61
- reply = @cmd.run_cmd "foo"
62
-
63
- reply.headers[:some_header].should == "New data"
64
- end
65
-
66
- should "read api/response responses" do
67
- @server.print "Content-Type: api/log\nSome-Header: Old data\n\n"
68
-
69
- @server.print "Content-Type: api/response\nSome-Header: New data\n\n"
70
- reply = @cmd.run_cmd "foo"
71
-
72
- reply.headers[:some_header].should == "New data"
73
- end
74
-
75
- should "read content if present" do
76
- @server.print "Content-Type: command/reply\nContent-Length: 3\n\n+OK\n\n"
77
- reply = @cmd.run_cmd "foo"
78
-
79
- reply.content.should == "+OK"
80
- end
81
-
82
- should "register command" do
83
- @cmd.should.respond_to? :sample_cmd
84
- end
85
-
86
- describe "registered" do
87
- before do
88
- 2.times {@server.gets} # get rid of the auth message
89
- end
90
-
91
- should "send command" do
92
- @server.print "Content-Type: command/reply\nContent-Length: 3\n\n+OK\n\n"
93
- @cmd.sample_cmd
94
- @server.gets.should == "api sample_cmd\n"
95
- end
96
-
97
- should "return response from command" do
98
- @server.print "Content-Type: command/reply\nContent-Length: 3\n\n+OK\n\n"
99
- response = @cmd.sample_cmd
100
- response.class.should == Librevox::Response
101
- response.content.should == "+OK"
102
- end
103
-
104
- should "pass arguments" do
105
- @server.print "Content-Type: command/reply\nContent-Length: 3\n\n+OK\n\n"
106
- @cmd.sample_cmd("foo bar")
107
- @server.gets.should == "api sample_cmd foo bar\n"
108
- end
109
- end
110
- end
111
- end