svxbox 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/spec.opts ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -0,0 +1,54 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'lib/svxbox.rb')
2
+
3
+ require 'test/unit'
4
+ require 'pathname'
5
+
6
+ require 'shoulda'
7
+ require 'matchy'
8
+ require 'mocha'
9
+ require 'fakeweb'
10
+ require 'stringio'
11
+
12
+ ENV['RACK_ENV'] = 'test'
13
+ ENV[:AMAZON_KEY] = ''
14
+ ENV[:AMAZON_ID] = ''
15
+
16
+ class Test::Unit::TestCase
17
+ include SvxBox::SupaBali
18
+ include SvxBox::Amazoni
19
+ include SvxBox::Sinatricus
20
+ end
21
+
22
+
23
+
24
+ def copy_stdout(&block)
25
+ o = StringIO.new
26
+ $stdout = o
27
+ block.call
28
+ o.close
29
+ o
30
+ ensure
31
+ $stdout = STDOUT
32
+ end
33
+
34
+ FakeWeb.allow_net_connect = false
35
+
36
+
37
+ def fixture_file(filename)
38
+ return '' if filename == ''
39
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
40
+ File.read(file_path)
41
+ end
42
+
43
+
44
+ def stub_request(method, url, filename, status=nil)
45
+ options = {:body => ""}
46
+ options.merge!({:body => fixture_file(filename)}) if filename
47
+ options.merge!({:body => status.last}) if status
48
+ options.merge!({:status => status}) if status
49
+
50
+ FakeWeb.register_uri(method, url, options)
51
+ end
52
+
53
+ def stub_get(*args); stub_request(:get, *args) end
54
+ def stub_post(*args); stub_request(:post, *args) end
@@ -0,0 +1,39 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ class SvxBoxTest < Test::Unit::TestCase
4
+ context "MarkupGuppy" do
5
+ setup do
6
+ @huh = "ok"
7
+ end
8
+ should "goback should be callable" do
9
+ result = goback
10
+ result.should == '<input type="button" onclick="history.go(-1);" value="Go Back" />'
11
+ end
12
+ end
13
+
14
+ context "Amazoni" do
15
+ should "search_aaws should be callable" do
16
+ stub_get(%r|http://ecs\.amazonaws\.com/|, "amazon_response.xml")
17
+ result = search_aaws('Books','Ruby Programming')
18
+ assert result.include?('buy')
19
+ end
20
+ end
21
+ context "Sinatricus" do
22
+ should "put msg when in development mode" do
23
+ ENV['RACK_ENV'] = 'development'
24
+ result = copy_stdout do
25
+ svx_debug('testing')
26
+ end
27
+ assert_equal "testing\n", result.string
28
+ end
29
+ end
30
+ context "Sinatricus" do
31
+ should "not put msg when in production mode" do
32
+ ENV['RACK_ENV'] = 'production'
33
+ result = copy_stdout do
34
+ svx_debug('testing')
35
+ end
36
+ assert_equal '', result.string
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Albert Lash
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-01 00:00:00 -04:00
17
+ date: 2010-05-02 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,11 @@ files:
49
49
  - lib/svxbox/ponyboy.rb
50
50
  - lib/svxbox/sinatricus.rb
51
51
  - lib/svxbox/supabali.rb
52
+ - test/fixtures/amazon_response.xml
53
+ - test/fixtures/amazon_response.yaml
54
+ - test/spec.opts
55
+ - test/spec_helper.rb
56
+ - test/svxbox_test.rb
52
57
  has_rdoc: true
53
58
  homepage: http://www.savonix.com
54
59
  licenses: []
@@ -79,5 +84,6 @@ rubygems_version: 1.3.6
79
84
  signing_key:
80
85
  specification_version: 3
81
86
  summary: Miscellaneous Utilities.
82
- test_files: []
83
-
87
+ test_files:
88
+ - test/spec_helper.rb
89
+ - test/svxbox_test.rb