mosquito 0.1.0 → 0.1.1
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 +6 -0
- data/Manifest.txt +2 -1
- data/{README → README.txt} +1 -1
- data/Rakefile +1 -2
- data/lib/mosquito.rb +38 -32
- metadata +25 -7
data/CHANGELOG
ADDED
data/Manifest.txt
CHANGED
data/{README → README.txt}
RENAMED
@@ -81,7 +81,7 @@ Make fixtures in +test/fixtures+. Remember that Camping models use the name of t
|
|
81
81
|
|
82
82
|
See +blog_test.rb+ for an example of both Functional and Unit tests.
|
83
83
|
|
84
|
-
== Warning:
|
84
|
+
== Warning: You are Camping, not Rail-riding
|
85
85
|
|
86
86
|
Test files start with +test_+ (test_blog.rb). Test classes start with +Test+ (TestBlog).
|
87
87
|
|
data/Rakefile
CHANGED
data/lib/mosquito.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
%w(
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
rubygems
|
3
|
+
test/unit
|
4
|
+
active_record
|
5
|
+
active_record/fixtures
|
6
|
+
active_support/binding_of_caller
|
7
|
+
camping
|
8
|
+
fileutils
|
9
|
+
stringio
|
10
|
+
cgi
|
11
11
|
).each { |lib| require lib }
|
12
12
|
|
13
13
|
module Mosquito
|
14
|
-
VERSION = '0.1.
|
14
|
+
VERSION = '0.1.1'
|
15
15
|
end
|
16
16
|
|
17
17
|
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ":memory:")
|
@@ -64,7 +64,7 @@ class MockRequest
|
|
64
64
|
def set(key, val)
|
65
65
|
@headers[key] = val
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
def to_hash
|
69
69
|
@headers
|
70
70
|
end
|
@@ -95,9 +95,9 @@ end
|
|
95
95
|
module Camping
|
96
96
|
|
97
97
|
class Test < Test::Unit::TestCase
|
98
|
-
|
98
|
+
|
99
99
|
def test_dummy; end
|
100
|
-
|
100
|
+
|
101
101
|
def deny(condition, message='')
|
102
102
|
assert !condition, message
|
103
103
|
end
|
@@ -110,7 +110,7 @@ module Camping
|
|
110
110
|
# # ...
|
111
111
|
# end
|
112
112
|
# end
|
113
|
-
#
|
113
|
+
#
|
114
114
|
# Is the number of items different?
|
115
115
|
#
|
116
116
|
# Can be used for increment and decrement.
|
@@ -123,9 +123,9 @@ module Camping
|
|
123
123
|
def assert_no_difference(object, method, &block)
|
124
124
|
assert_difference object, method, 0, &block
|
125
125
|
end
|
126
|
-
|
126
|
+
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
class FunctionalTest < Test
|
130
130
|
|
131
131
|
def setup
|
@@ -134,24 +134,32 @@ module Camping
|
|
134
134
|
@cookies = @response = {}
|
135
135
|
end
|
136
136
|
|
137
|
-
def get(url='/')
|
138
|
-
send_request url,
|
137
|
+
def get(url='/', vars={})
|
138
|
+
send_request url, vars, 'GET'
|
139
139
|
end
|
140
140
|
|
141
141
|
def post(url, post_vars={})
|
142
142
|
send_request url, post_vars, 'POST'
|
143
143
|
end
|
144
144
|
|
145
|
+
def delete(url, vars={})
|
146
|
+
send_request url, vars, 'DELETE'
|
147
|
+
end
|
148
|
+
|
149
|
+
def put(url, vars={})
|
150
|
+
send_request url, vars, 'PUT'
|
151
|
+
end
|
152
|
+
|
145
153
|
def send_request(url, post_vars, method)
|
146
154
|
@request['REQUEST_METHOD'] = method
|
147
155
|
@request['SCRIPT_NAME'] = '/' + @class_name_abbr.downcase
|
148
156
|
@request['PATH_INFO'] = '/' + url
|
149
157
|
@request['REQUEST_URI'] = [@request.SCRIPT_NAME, @request.PATH_INFO].join('')
|
150
|
-
|
158
|
+
|
151
159
|
@request['HTTP_COOKIE'] = @cookies.map {|k,v| "#{k}=#{v}" }.join('; ') if @cookies
|
152
|
-
|
160
|
+
|
153
161
|
@response = eval("#{@class_name_abbr}.run StringIO.new('#{qs_build(post_vars)}'), @request")
|
154
|
-
|
162
|
+
|
155
163
|
@cookies = @response.headers['Set-Cookie'].inject(@cookies||{}) do |res,header|
|
156
164
|
data = header.split(';').first
|
157
165
|
name, value = data.split('=')
|
@@ -161,7 +169,7 @@ module Camping
|
|
161
169
|
|
162
170
|
if @response.headers['X-Sendfile']
|
163
171
|
@response.body = File.read(@response.headers['X-Sendfile'])
|
164
|
-
end
|
172
|
+
end
|
165
173
|
end
|
166
174
|
|
167
175
|
def assert_response(status_code)
|
@@ -179,19 +187,17 @@ module Camping
|
|
179
187
|
|
180
188
|
def assert_match_body(regex, message=nil)
|
181
189
|
assert_match regex, @response.body, message
|
182
|
-
end
|
190
|
+
end
|
183
191
|
def assert_no_match_body(regex, message=nil)
|
184
192
|
assert_no_match regex, @response.body, message
|
185
193
|
end
|
186
|
-
|
194
|
+
|
187
195
|
def assert_redirected_to(url, message=nil)
|
188
|
-
assert_equal
|
189
|
-
@response.headers['Location'].path.gsub(%r!/#{@class_name_abbr.downcase}!, ''),
|
190
|
-
message
|
196
|
+
assert_equal url, @response.headers['Location'].path.gsub(%r!/#{@class_name_abbr.downcase}!, ''), message
|
191
197
|
end
|
192
|
-
|
198
|
+
|
193
199
|
def assert_cookie(name, pat, message=nil)
|
194
|
-
|
200
|
+
assert_match pat, @cookies[name], message
|
195
201
|
end
|
196
202
|
|
197
203
|
def test_dummy; end
|
@@ -207,9 +213,9 @@ module Camping
|
|
207
213
|
end
|
208
214
|
|
209
215
|
class UnitTest < Test
|
210
|
-
|
216
|
+
|
211
217
|
def test_dummy; end
|
212
|
-
|
218
|
+
|
213
219
|
end
|
214
|
-
|
220
|
+
|
215
221
|
end
|
metadata
CHANGED
@@ -3,12 +3,11 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: mosquito
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2006-12-06 00:00:00 -08:00
|
8
8
|
summary: A Camping test library.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
- test
|
12
11
|
email: boss@topfunky.com
|
13
12
|
homepage: http://mosquito.rubyforge.org
|
14
13
|
rubyforge_project: mosquito
|
@@ -31,8 +30,9 @@ authors:
|
|
31
30
|
- Geoffrey Grosenbach
|
32
31
|
files:
|
33
32
|
- Rakefile
|
34
|
-
- README
|
33
|
+
- README.txt
|
35
34
|
- MIT-LICENSE
|
35
|
+
- CHANGELOG
|
36
36
|
- Manifest.txt
|
37
37
|
- lib
|
38
38
|
- lib/mosquito.rb
|
@@ -65,11 +65,29 @@ requirements: []
|
|
65
65
|
|
66
66
|
dependencies:
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
68
|
+
name: active_record
|
69
|
+
version_requirement:
|
70
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.0.0
|
75
|
+
version:
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: active_support
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.0.0
|
84
|
+
version:
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: camping
|
69
87
|
version_requirement:
|
70
88
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
71
89
|
requirements:
|
72
|
-
- - "
|
90
|
+
- - ">"
|
73
91
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
92
|
+
version: 0.0.0
|
75
93
|
version:
|