caulfield 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lib/caulfield/middleware.rb +4 -4
- data/lib/caulfield/version.rb +1 -1
- data/lib/caulfield.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -32,4 +32,6 @@ You can wrap whatever DSL you like around these methods. For example:
|
|
32
32
|
Caulfield.set_session :user_id => nil
|
33
33
|
end
|
34
34
|
|
35
|
+
In addition to the session and cookies from the request, you can also access the ActionDispatch::Request object from the last request with Caulfield.request, and the components of the app's last Rack response with Caulfield.status, Caulfield.headers, and Caulfield.body.
|
36
|
+
|
35
37
|
Happy testing!
|
data/lib/caulfield/middleware.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Caulfield
|
2
2
|
class Middleware
|
3
3
|
@@instance = new
|
4
|
-
attr_accessor :app, :session, :cookies, :request, :
|
4
|
+
attr_accessor :app, :session, :cookies, :request, :status, :headers, :body
|
5
5
|
|
6
6
|
class << self
|
7
7
|
def new(app)
|
@@ -21,16 +21,16 @@ module Caulfield
|
|
21
21
|
merge_cookies unless @cookies_to_merge.empty?
|
22
22
|
merge_session unless @session_to_merge.empty?
|
23
23
|
|
24
|
-
@
|
24
|
+
@status, @headers, @body = @app.call(env)
|
25
25
|
|
26
26
|
@cookies = @request.cookie_jar
|
27
27
|
@session = @request.session
|
28
28
|
|
29
|
-
[@
|
29
|
+
[@status, @headers, @body]
|
30
30
|
end
|
31
31
|
|
32
32
|
def reset
|
33
|
-
@cookies = @session = @request = @
|
33
|
+
@cookies = @session = @request = @status = @headers = @body = nil
|
34
34
|
|
35
35
|
@cookies_to_merge = {}
|
36
36
|
@session_to_merge = {}
|
data/lib/caulfield/version.rb
CHANGED
data/lib/caulfield.rb
CHANGED
@@ -2,7 +2,7 @@ require 'caulfield/middleware'
|
|
2
2
|
|
3
3
|
module Caulfield
|
4
4
|
class << self
|
5
|
-
delegate :reset, :request, :
|
5
|
+
delegate :reset, :request, :status, :headers, :body,
|
6
6
|
:session, :cookies, :set_session, :set_cookies,
|
7
7
|
:to => 'Caulfield::Middleware.instance'
|
8
8
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Chris Hanks
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-14 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|