monster_mash 0.1.1 → 0.1.2
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/CHANGELOG.markdown +4 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/monster_mash/base.rb +2 -0
- data/monster_mash.gemspec +6 -5
- data/spec/monster_mash/base_spec.rb +17 -19
- data/spec/monster_mash/request_spec.rb +14 -15
- metadata +6 -5
data/CHANGELOG.markdown
ADDED
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
gem.authors = ["David Balatero"]
|
13
13
|
gem.add_dependency "typhoeus", ">= 0.1.25"
|
14
14
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
-
gem.add_development_dependency "typhoeus_spec_cache", ">= 0.2.
|
15
|
+
gem.add_development_dependency "typhoeus_spec_cache", ">= 0.2.2"
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
17
|
end
|
18
18
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/monster_mash/base.rb
CHANGED
@@ -93,6 +93,7 @@ module MonsterMash
|
|
93
93
|
if hydra.nil?
|
94
94
|
# serial request.
|
95
95
|
response = request.run_serial_request
|
96
|
+
check_response_and_raise!(response)
|
96
97
|
request.handler.call(response)
|
97
98
|
else
|
98
99
|
# parallel hydra request.
|
@@ -100,6 +101,7 @@ module MonsterMash
|
|
100
101
|
typhoeus_request.on_complete do |response|
|
101
102
|
result, error = nil, nil
|
102
103
|
begin
|
104
|
+
check_response_and_raise!(response)
|
103
105
|
result = request.handler.call(response)
|
104
106
|
rescue => e
|
105
107
|
error = e
|
data/monster_mash.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{monster_mash}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Balatero"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-07-16}
|
13
13
|
s.description = %q{Provides a fun HTTP interface on top of Typhoeus!}
|
14
14
|
s.email = %q{dbalatero@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
22
|
".gitignore",
|
23
|
+
"CHANGELOG.markdown",
|
23
24
|
"LICENSE",
|
24
25
|
"README.markdown",
|
25
26
|
"Rakefile",
|
@@ -54,16 +55,16 @@ Gem::Specification.new do |s|
|
|
54
55
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
55
56
|
s.add_runtime_dependency(%q<typhoeus>, [">= 0.1.25"])
|
56
57
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
57
|
-
s.add_development_dependency(%q<typhoeus_spec_cache>, [">= 0.2.
|
58
|
+
s.add_development_dependency(%q<typhoeus_spec_cache>, [">= 0.2.2"])
|
58
59
|
else
|
59
60
|
s.add_dependency(%q<typhoeus>, [">= 0.1.25"])
|
60
61
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
61
|
-
s.add_dependency(%q<typhoeus_spec_cache>, [">= 0.2.
|
62
|
+
s.add_dependency(%q<typhoeus_spec_cache>, [">= 0.2.2"])
|
62
63
|
end
|
63
64
|
else
|
64
65
|
s.add_dependency(%q<typhoeus>, [">= 0.1.25"])
|
65
66
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
66
|
-
s.add_dependency(%q<typhoeus_spec_cache>, [">= 0.2.
|
67
|
+
s.add_dependency(%q<typhoeus_spec_cache>, [">= 0.2.2"])
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
@@ -3,26 +3,26 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
3
3
|
class MockApi < MonsterMash::Base
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
describe "inheriting defaults from superclasses" do
|
8
|
-
before(:all) do
|
9
|
-
class A < MonsterMash::Base
|
10
|
-
defaults do
|
11
|
-
cache_timeout 9999
|
12
|
-
timeout 500
|
13
|
-
end
|
14
|
-
end
|
6
|
+
class CustomMockError < StandardError; end
|
15
7
|
|
16
|
-
|
17
|
-
|
8
|
+
class A < MonsterMash::Base
|
9
|
+
defaults do
|
10
|
+
cache_timeout 9999
|
11
|
+
timeout 500
|
12
|
+
end
|
13
|
+
end
|
18
14
|
|
19
|
-
|
20
|
-
|
21
|
-
cache_timeout 100
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
15
|
+
class B < A
|
16
|
+
end
|
25
17
|
|
18
|
+
class C < A
|
19
|
+
defaults do
|
20
|
+
cache_timeout 100
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe MonsterMash::Base do
|
25
|
+
describe "inheriting defaults from superclasses" do
|
26
26
|
it "should propagate defaults to B" do
|
27
27
|
B.defaults.should == A.defaults
|
28
28
|
B.defaults.should have(1).thing
|
@@ -154,8 +154,6 @@ describe MonsterMash::Base do
|
|
154
154
|
describe "error propagation" do
|
155
155
|
typhoeus_spec_cache("spec/cache/errors") do |hydra|
|
156
156
|
before(:all) do
|
157
|
-
class CustomMockError < StandardError; end
|
158
|
-
|
159
157
|
MockApi.build_method(:get, :google_json2) do |search|
|
160
158
|
uri 'http://ajax.googleapis.com/ajax/services/search/web'
|
161
159
|
params({
|
@@ -1,5 +1,19 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
|
+
class ApplyDefaultsA < MonsterMash::Base
|
4
|
+
defaults do
|
5
|
+
timeout 100
|
6
|
+
cache_timeout 9999
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class ApplyDefaultsB < ApplyDefaultsA
|
11
|
+
defaults do
|
12
|
+
timeout 50
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
3
17
|
describe MonsterMash::Request do
|
4
18
|
describe "#new" do
|
5
19
|
it "should evaluate the passed in block in context" do
|
@@ -45,21 +59,6 @@ describe MonsterMash::Request do
|
|
45
59
|
end
|
46
60
|
|
47
61
|
describe "#apply_defaults" do
|
48
|
-
before(:all) do
|
49
|
-
class ApplyDefaultsA < MonsterMash::Base
|
50
|
-
defaults do
|
51
|
-
timeout 100
|
52
|
-
cache_timeout 9999
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class ApplyDefaultsB < ApplyDefaultsA
|
57
|
-
defaults do
|
58
|
-
timeout 50
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
62
|
it "should apply the defaults in inheritance order" do
|
64
63
|
request = MonsterMash::Request.new(:get)
|
65
64
|
request.apply_defaults(ApplyDefaultsB.defaults)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David Balatero
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-07-16 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -55,8 +55,8 @@ dependencies:
|
|
55
55
|
segments:
|
56
56
|
- 0
|
57
57
|
- 2
|
58
|
-
-
|
59
|
-
version: 0.2.
|
58
|
+
- 2
|
59
|
+
version: 0.2.2
|
60
60
|
type: :development
|
61
61
|
version_requirements: *id003
|
62
62
|
description: Provides a fun HTTP interface on top of Typhoeus!
|
@@ -72,6 +72,7 @@ extra_rdoc_files:
|
|
72
72
|
files:
|
73
73
|
- .document
|
74
74
|
- .gitignore
|
75
|
+
- CHANGELOG.markdown
|
75
76
|
- LICENSE
|
76
77
|
- README.markdown
|
77
78
|
- Rakefile
|