roflbot 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/roflbot.rb +1 -0
- data/lib/roflbot/base.rb +42 -25
- data/roflbot.gemspec +31 -3
- data/test/helper.rb +10 -0
- data/test/roflbot/test_base.rb +24 -0
- data/vendor/gvoice-ruby/Gemfile +11 -0
- data/vendor/gvoice-ruby/README.rdoc +71 -0
- data/vendor/gvoice-ruby/Rakefile +12 -0
- data/vendor/gvoice-ruby/VERSION +1 -0
- data/vendor/gvoice-ruby/bin/gv-notifier +75 -0
- data/vendor/gvoice-ruby/bin/gv-place-call +18 -0
- data/vendor/gvoice-ruby/bin/gv-send-sms +12 -0
- data/vendor/gvoice-ruby/config/gvoice-ruby-config.yml.sample +10 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby.rb +6 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/call.rb +9 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/client.rb +264 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/compatibility.rb +37 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/config.rb +39 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/inbox_parser.rb +126 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/sms.rb +9 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/user.rb +12 -0
- data/vendor/gvoice-ruby/lib/gvoice-ruby/voicemail.rb +10 -0
- data/vendor/gvoice-ruby/test/client_test.rb +45 -0
- data/vendor/gvoice-ruby/test/config_test.rb +37 -0
- data/vendor/gvoice-ruby/test/fixtures/config_fixture.yml +10 -0
- data/vendor/gvoice-ruby/test/fixtures/inbox.json +1 -0
- data/vendor/gvoice-ruby/test/fixtures/inbox.yml +206 -0
- data/vendor/gvoice-ruby/test/fixtures/inbox_fixture.html +2854 -0
- data/vendor/gvoice-ruby/test/fixtures/login_fixture.html +567 -0
- data/vendor/gvoice-ruby/test/gvoice-ruby_test.rb +9 -0
- data/vendor/gvoice-ruby/test/inbox_parser_test.rb +54 -0
- data/vendor/gvoice-ruby/test/test_helper.rb +19 -0
- metadata +31 -3
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/test_helper"
|
2
|
+
|
3
|
+
require "inbox_parser"
|
4
|
+
require 'mocha'
|
5
|
+
|
6
|
+
class InboxParserTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@page_body = String.new(File.read(File.join(File.dirname(__FILE__), 'fixtures', 'inbox_fixture.html')))
|
10
|
+
@inbox_fixture = File.open(File.join(File.dirname(__FILE__), 'fixtures', 'inbox.yml')) { |yf| YAML::load(yf) }
|
11
|
+
@page_obj = mock()
|
12
|
+
@page_obj.stubs(:body_str).returns(@page_body)
|
13
|
+
end
|
14
|
+
|
15
|
+
should "return true" do
|
16
|
+
assert true
|
17
|
+
end
|
18
|
+
|
19
|
+
should "create instance variables" do
|
20
|
+
ibp = GvoiceRuby::InboxParser.new
|
21
|
+
assert_equal([], ibp.instance_variable_get(:@smss))
|
22
|
+
assert_equal([], ibp.instance_variable_get(:@voicemails))
|
23
|
+
end
|
24
|
+
|
25
|
+
should "parse the page" do
|
26
|
+
GvoiceRuby::Client.any_instance.stubs(:fetch_page).returns(true)
|
27
|
+
inbox = GvoiceRuby::InboxParser.new.parse_page(@page_obj)
|
28
|
+
assert_equal(Hash, inbox.class)
|
29
|
+
assert_equal(@inbox_fixture, inbox)
|
30
|
+
end
|
31
|
+
|
32
|
+
should "parse sms messages" do
|
33
|
+
GvoiceRuby::Client.any_instance.stubs(:fetch_page).returns(true)
|
34
|
+
parser = GvoiceRuby::InboxParser.new
|
35
|
+
inbox = parser.parse_page(@page_obj)
|
36
|
+
parser.parse_sms_messages(inbox['messages'])
|
37
|
+
assert_equal(parser.instance_variable_get(:@smss)[0].class, GvoiceRuby::Sms)
|
38
|
+
assert_equal(parser.instance_variable_get(:@voicemails), [])
|
39
|
+
# y parser.parse_sms_messages(inbox['messages'])
|
40
|
+
# y parser.instance_variable_get(:@smss)
|
41
|
+
end
|
42
|
+
|
43
|
+
should "parse voicemail messages" do
|
44
|
+
GvoiceRuby::Client.any_instance.stubs(:fetch_page).returns(true)
|
45
|
+
parser = GvoiceRuby::InboxParser.new
|
46
|
+
inbox = parser.parse_page(@page_obj)
|
47
|
+
parser.parse_voicemail_messages(inbox['messages'])
|
48
|
+
assert_equal(parser.instance_variable_get(:@voicemails)[0].class, GvoiceRuby::Voicemail)
|
49
|
+
assert_equal(parser.instance_variable_get(:@smss), [])
|
50
|
+
# y parser.parse_sms_messages(inbox['messages'])
|
51
|
+
# y parser.instance_variable_get(:@smss)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'shoulda'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
+
require 'gvoice-ruby'
|
9
|
+
|
10
|
+
class Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup_config_fixture
|
13
|
+
@config_file = File.join(File.dirname(__FILE__), 'fixtures', 'config_fixture.yml')
|
14
|
+
end
|
15
|
+
|
16
|
+
def deny(*args)
|
17
|
+
args.each { |arg| assert !arg }
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeremy Stephens
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-07 00:00:00 -05:00
|
18
18
|
default_executable: roflbot
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -64,6 +64,7 @@ extra_rdoc_files:
|
|
64
64
|
- README
|
65
65
|
files:
|
66
66
|
- .gitignore
|
67
|
+
- .gitmodules
|
67
68
|
- LICENSE
|
68
69
|
- README
|
69
70
|
- Rakefile
|
@@ -80,6 +81,33 @@ files:
|
|
80
81
|
- test/roflbot/test_base.rb
|
81
82
|
- test/roflbot/test_runner.rb
|
82
83
|
- test/roflbot/test_sentence_bot.rb
|
84
|
+
- vendor/gvoice-ruby/Gemfile
|
85
|
+
- vendor/gvoice-ruby/README.rdoc
|
86
|
+
- vendor/gvoice-ruby/Rakefile
|
87
|
+
- vendor/gvoice-ruby/VERSION
|
88
|
+
- vendor/gvoice-ruby/bin/gv-notifier
|
89
|
+
- vendor/gvoice-ruby/bin/gv-place-call
|
90
|
+
- vendor/gvoice-ruby/bin/gv-send-sms
|
91
|
+
- vendor/gvoice-ruby/config/gvoice-ruby-config.yml.sample
|
92
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby.rb
|
93
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/call.rb
|
94
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/client.rb
|
95
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/compatibility.rb
|
96
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/config.rb
|
97
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/inbox_parser.rb
|
98
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/sms.rb
|
99
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/user.rb
|
100
|
+
- vendor/gvoice-ruby/lib/gvoice-ruby/voicemail.rb
|
101
|
+
- vendor/gvoice-ruby/test/client_test.rb
|
102
|
+
- vendor/gvoice-ruby/test/config_test.rb
|
103
|
+
- vendor/gvoice-ruby/test/fixtures/config_fixture.yml
|
104
|
+
- vendor/gvoice-ruby/test/fixtures/inbox.json
|
105
|
+
- vendor/gvoice-ruby/test/fixtures/inbox.yml
|
106
|
+
- vendor/gvoice-ruby/test/fixtures/inbox_fixture.html
|
107
|
+
- vendor/gvoice-ruby/test/fixtures/login_fixture.html
|
108
|
+
- vendor/gvoice-ruby/test/gvoice-ruby_test.rb
|
109
|
+
- vendor/gvoice-ruby/test/inbox_parser_test.rb
|
110
|
+
- vendor/gvoice-ruby/test/test_helper.rb
|
83
111
|
has_rdoc: true
|
84
112
|
homepage: http://github.com/viking/roflbot
|
85
113
|
licenses: []
|