remi-rackbox 1.1.1 → 1.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/README.markdown +1 -0
- data/VERSION.yml +1 -1
- data/lib/rackbox/rackbox.rb +8 -1
- data/spec/request_method_spec.rb +6 -0
- metadata +2 -2
data/README.markdown
CHANGED
@@ -92,6 +92,7 @@ TODO
|
|
92
92
|
|
93
93
|
- request('/', :format => :json) # simple helpers for content type request accepts
|
94
94
|
- get usage documentation working for `./script/generate blackbox_spec`
|
95
|
+
- refactor all specs ... an app should implement a simple API that we can spec against ... some URIs should return session vars, some request vars, etc
|
95
96
|
|
96
97
|
|
97
98
|
|
data/VERSION.yml
CHANGED
data/lib/rackbox/rackbox.rb
CHANGED
@@ -35,9 +35,16 @@ class RackBox
|
|
35
35
|
# TODO take any additional options and pass them along to the environment, so we can say
|
36
36
|
# req '/', :user_agent => 'some custom user agent'
|
37
37
|
#
|
38
|
-
def req app_or_request, url, options = {}
|
38
|
+
def req app_or_request, url = nil, options = {}
|
39
39
|
puts "RackBox#request url:#{ url.inspect }, options:#{ options.inspect }" if RackBox.verbose
|
40
40
|
|
41
|
+
# handle RackBox.request '/foo'
|
42
|
+
if app_or_request.is_a?(String) && ( url.nil? || url.is_a?(Hash) )
|
43
|
+
options = url || {}
|
44
|
+
url = app_or_request
|
45
|
+
app_or_request = RackBox.app
|
46
|
+
end
|
47
|
+
|
41
48
|
# need to find the request or app
|
42
49
|
mock_request = nil
|
43
50
|
if app_or_request.is_a? Rack::MockRequest
|
data/spec/request_method_spec.rb
CHANGED
@@ -14,4 +14,10 @@ describe RackBox, '#request' do
|
|
14
14
|
RackBox.request(@rack_app, '/hello').body.should include('you requested path /hello')
|
15
15
|
end
|
16
16
|
|
17
|
+
it "should default to using RackBox.app if an app isn't passed" do
|
18
|
+
lambda { RackBox.request('/hello') }.should raise_error
|
19
|
+
RackBox.app = @rack_app
|
20
|
+
RackBox.request('/hello').body.should include('you requested path /hello')
|
21
|
+
end
|
22
|
+
|
17
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remi-rackbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- remi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-05 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|