itrigga-net_helper 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -2
- data/README.rdoc +36 -1
- data/Rakefile +18 -13
- data/VERSION +1 -1
- data/lib/itrigga/net_helper.rb +52 -145
- data/lib/itrigga/net_helper/rest_client.rb +19 -0
- data/lib/itrigga/net_helper/typhoeus.rb +35 -0
- data/spec/net_helper/rest_client_spec.rb +32 -0
- data/spec/net_helper/typhoeus_spec.rb +90 -0
- data/spec/net_helper_spec.rb +167 -236
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +54 -16
- metadata +95 -31
- data/Gemfile.lock +0 -36
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
CHANGED
@@ -1,23 +1,61 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
require 'rspec'
|
1
|
+
# require 'rubygems'
|
2
|
+
# require 'bundler'
|
3
|
+
# begin
|
4
|
+
# Bundler.setup(:default, :development)
|
5
|
+
# rescue Bundler::BundlerError => e
|
6
|
+
# $stderr.puts e.message
|
7
|
+
# $stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
# exit e.status_code
|
9
|
+
# end
|
10
|
+
# require 'test/unit'
|
11
|
+
# require 'rspec'
|
12
|
+
#
|
13
|
+
# $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
# $LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
#
|
16
|
+
# require 'itrigga/core_ext'
|
17
|
+
# require 'itrigga/net_helper'
|
18
|
+
#
|
19
|
+
# Dir.chdir(File.join(File.dirname(__FILE__), '..'))
|
20
|
+
#
|
21
|
+
# RSpec.configure do |config|
|
22
|
+
# # some (optional) config here
|
23
|
+
# end
|
12
24
|
|
13
25
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
26
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
27
|
+
RAILS_ENV = "test"
|
15
28
|
|
16
|
-
require 'itrigga/core_ext'
|
17
29
|
require 'itrigga/net_helper'
|
18
30
|
|
19
|
-
|
31
|
+
# Requires supporting files with custom matchers and macros, etc,
|
32
|
+
# in ./support/ and its subdirectories.
|
33
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
34
|
+
|
20
35
|
|
21
|
-
|
22
|
-
|
23
|
-
|
36
|
+
# taken from http://digitaldumptruck.jotabout.com/?p=551
|
37
|
+
# allows dynamic re-definition of constants, returning them to previous state after the test
|
38
|
+
# also kills those pesky warnings about 'Constant XXX already defined'
|
39
|
+
def with_constants(constants, &block)
|
40
|
+
saved_constants = {}
|
41
|
+
constants.each do |constant, val|
|
42
|
+
saved_constants[ constant ] = Object.const_get( constant )
|
43
|
+
Kernel::silence_warnings { Object.const_set( constant, val ) }
|
44
|
+
end
|
45
|
+
|
46
|
+
begin
|
47
|
+
block.call
|
48
|
+
ensure
|
49
|
+
constants.each do |constant, val|
|
50
|
+
Kernel::silence_warnings { Object.const_set( constant, saved_constants[ constant ] ) }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# taken from activesupport/lib/active_support/core_ext/kernel/reporting.rb
|
56
|
+
def silence_warnings
|
57
|
+
old_verbose, $VERBOSE = $VERBOSE, nil
|
58
|
+
yield
|
59
|
+
ensure
|
60
|
+
$VERBOSE = old_verbose
|
61
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itrigga-net_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
|
10
|
+
segments_generated: true
|
11
|
+
version: 0.3.0
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Al Davidson
|
@@ -15,12 +16,12 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-11-15 00:00:00 +00:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
prerelease: false
|
23
|
-
name:
|
24
|
+
name: rest-client
|
24
25
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
26
|
none: false
|
26
27
|
requirements:
|
@@ -29,13 +30,59 @@ dependencies:
|
|
29
30
|
hash: 3
|
30
31
|
segments:
|
31
32
|
- 0
|
33
|
+
segments_generated: true
|
32
34
|
version: "0"
|
33
35
|
requirement: *id001
|
36
|
+
type: :runtime
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
39
|
+
name: hpricot
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
segments_generated: true
|
49
|
+
version: "0"
|
50
|
+
requirement: *id002
|
51
|
+
type: :runtime
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
prerelease: false
|
54
|
+
name: itrigga-core_ext
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
segments_generated: true
|
64
|
+
version: "0"
|
65
|
+
requirement: *id003
|
66
|
+
type: :runtime
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
prerelease: false
|
69
|
+
name: hpricot
|
70
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
segments_generated: true
|
79
|
+
version: "0"
|
80
|
+
requirement: *id004
|
34
81
|
type: :development
|
35
82
|
- !ruby/object:Gem::Dependency
|
36
83
|
prerelease: false
|
37
84
|
name: bundler
|
38
|
-
version_requirements: &
|
85
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
39
86
|
none: false
|
40
87
|
requirements:
|
41
88
|
- - ~>
|
@@ -45,13 +92,14 @@ dependencies:
|
|
45
92
|
- 1
|
46
93
|
- 0
|
47
94
|
- 0
|
95
|
+
segments_generated: true
|
48
96
|
version: 1.0.0
|
49
|
-
requirement: *
|
97
|
+
requirement: *id005
|
50
98
|
type: :development
|
51
99
|
- !ruby/object:Gem::Dependency
|
52
100
|
prerelease: false
|
53
101
|
name: jeweler
|
54
|
-
version_requirements: &
|
102
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
55
103
|
none: false
|
56
104
|
requirements:
|
57
105
|
- - ~>
|
@@ -61,41 +109,48 @@ dependencies:
|
|
61
109
|
- 1
|
62
110
|
- 6
|
63
111
|
- 4
|
112
|
+
segments_generated: true
|
64
113
|
version: 1.6.4
|
65
|
-
requirement: *
|
114
|
+
requirement: *id006
|
66
115
|
type: :development
|
67
116
|
- !ruby/object:Gem::Dependency
|
68
117
|
prerelease: false
|
69
|
-
name:
|
70
|
-
version_requirements: &
|
118
|
+
name: rspec
|
119
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
71
120
|
none: false
|
72
121
|
requirements:
|
73
|
-
- - "
|
122
|
+
- - "="
|
74
123
|
- !ruby/object:Gem::Version
|
75
|
-
hash:
|
124
|
+
hash: 27
|
76
125
|
segments:
|
126
|
+
- 1
|
127
|
+
- 3
|
77
128
|
- 0
|
78
|
-
|
79
|
-
|
129
|
+
segments_generated: true
|
130
|
+
version: 1.3.0
|
131
|
+
requirement: *id007
|
80
132
|
type: :development
|
81
133
|
- !ruby/object:Gem::Dependency
|
82
134
|
prerelease: false
|
83
|
-
name: rspec
|
84
|
-
version_requirements: &
|
135
|
+
name: rspec-rails
|
136
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
85
137
|
none: false
|
86
138
|
requirements:
|
87
|
-
- - "
|
139
|
+
- - "="
|
88
140
|
- !ruby/object:Gem::Version
|
89
|
-
hash:
|
141
|
+
hash: 31
|
90
142
|
segments:
|
91
|
-
-
|
92
|
-
|
93
|
-
|
143
|
+
- 1
|
144
|
+
- 3
|
145
|
+
- 2
|
146
|
+
segments_generated: true
|
147
|
+
version: 1.3.2
|
148
|
+
requirement: *id008
|
94
149
|
type: :development
|
95
150
|
- !ruby/object:Gem::Dependency
|
96
151
|
prerelease: false
|
97
|
-
name:
|
98
|
-
version_requirements: &
|
152
|
+
name: rcov
|
153
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
99
154
|
none: false
|
100
155
|
requirements:
|
101
156
|
- - ">="
|
@@ -103,13 +158,14 @@ dependencies:
|
|
103
158
|
hash: 3
|
104
159
|
segments:
|
105
160
|
- 0
|
161
|
+
segments_generated: true
|
106
162
|
version: "0"
|
107
|
-
requirement: *
|
163
|
+
requirement: *id009
|
108
164
|
type: :development
|
109
165
|
- !ruby/object:Gem::Dependency
|
110
166
|
prerelease: false
|
111
|
-
name:
|
112
|
-
version_requirements: &
|
167
|
+
name: json_pure
|
168
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
113
169
|
none: false
|
114
170
|
requirements:
|
115
171
|
- - ">="
|
@@ -117,13 +173,14 @@ dependencies:
|
|
117
173
|
hash: 3
|
118
174
|
segments:
|
119
175
|
- 0
|
176
|
+
segments_generated: true
|
120
177
|
version: "0"
|
121
|
-
requirement: *
|
178
|
+
requirement: *id010
|
122
179
|
type: :development
|
123
180
|
- !ruby/object:Gem::Dependency
|
124
181
|
prerelease: false
|
125
182
|
name: fastercsv
|
126
|
-
version_requirements: &
|
183
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
127
184
|
none: false
|
128
185
|
requirements:
|
129
186
|
- - ">="
|
@@ -133,8 +190,9 @@ dependencies:
|
|
133
190
|
- 1
|
134
191
|
- 5
|
135
192
|
- 4
|
193
|
+
segments_generated: true
|
136
194
|
version: 1.5.4
|
137
|
-
requirement: *
|
195
|
+
requirement: *id011
|
138
196
|
type: :development
|
139
197
|
description: Provides various more convenient wrappers around Net::HTTP methods
|
140
198
|
email: aldavidson@trigga.com
|
@@ -147,13 +205,17 @@ extra_rdoc_files:
|
|
147
205
|
- README.rdoc
|
148
206
|
files:
|
149
207
|
- Gemfile
|
150
|
-
- Gemfile.lock
|
151
208
|
- LICENSE.txt
|
152
209
|
- README.rdoc
|
153
210
|
- Rakefile
|
154
211
|
- VERSION
|
155
212
|
- lib/itrigga/net_helper.rb
|
213
|
+
- lib/itrigga/net_helper/rest_client.rb
|
214
|
+
- lib/itrigga/net_helper/typhoeus.rb
|
215
|
+
- spec/net_helper/rest_client_spec.rb
|
216
|
+
- spec/net_helper/typhoeus_spec.rb
|
156
217
|
- spec/net_helper_spec.rb
|
218
|
+
- spec/spec.opts
|
157
219
|
- spec/spec_helper.rb
|
158
220
|
- test/helper.rb
|
159
221
|
- test/test_net_helper.rb
|
@@ -176,6 +238,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
176
238
|
hash: 3
|
177
239
|
segments:
|
178
240
|
- 0
|
241
|
+
segments_generated: true
|
179
242
|
version: "0"
|
180
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
244
|
none: false
|
@@ -185,6 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
248
|
hash: 3
|
186
249
|
segments:
|
187
250
|
- 0
|
251
|
+
segments_generated: true
|
188
252
|
version: "0"
|
189
253
|
requirements: []
|
190
254
|
|
data/Gemfile.lock
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
diff-lcs (1.1.2)
|
5
|
-
fastercsv (1.5.4)
|
6
|
-
git (1.2.5)
|
7
|
-
hpricot (0.8.4)
|
8
|
-
itrigga-core_ext (0.1.0)
|
9
|
-
jeweler (1.6.4)
|
10
|
-
bundler (~> 1.0)
|
11
|
-
git (>= 1.2.5)
|
12
|
-
rake
|
13
|
-
json_pure (1.5.1)
|
14
|
-
rake (0.8.7)
|
15
|
-
rcov (0.9.9)
|
16
|
-
rspec (2.5.0)
|
17
|
-
rspec-core (~> 2.5.0)
|
18
|
-
rspec-expectations (~> 2.5.0)
|
19
|
-
rspec-mocks (~> 2.5.0)
|
20
|
-
rspec-core (2.5.1)
|
21
|
-
rspec-expectations (2.5.0)
|
22
|
-
diff-lcs (~> 1.1.2)
|
23
|
-
rspec-mocks (2.5.0)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
bundler (~> 1.0.0)
|
30
|
-
fastercsv (>= 1.5.4)
|
31
|
-
hpricot
|
32
|
-
itrigga-core_ext
|
33
|
-
jeweler (~> 1.6.4)
|
34
|
-
json_pure
|
35
|
-
rcov
|
36
|
-
rspec
|