riot-rails 0.2.0.pre.1 → 0.2.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  *0.2.0.pre.1*
2
2
 
3
+ * When rails does redirects, it does not set action_controller.instance as you might expect; users should still have access to the response, though. This fixes that [jaknowlden]
4
+
5
+ *0.2.0.pre.1*
6
+
3
7
  * Actually relying on riot-0.11.1. Whoops. [jaknowlden]
4
8
 
5
9
  *0.2.0.pre*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0.pre.1
1
+ 0.2.0.pre.2
@@ -24,17 +24,12 @@ module RiotRails
24
24
  def setup_situation(context)
25
25
  context.helper(:app) { @app }
26
26
  context.helper(:env) { @env }
27
- context.helper(:controller) { env["action_controller.instance"] }
28
-
29
- context.helper(:request) do
30
- return controller.request if controller
31
- raise Exception, "No request made yet"
27
+ context.helper(:controller) do
28
+ env["action_controller.instance"] || raise(Exception, "Instance of controller not found")
32
29
  end
33
30
 
34
- context.helper(:response) do
35
- return controller.response if controller
36
- raise Exception, "No response since no request made yet"
37
- end
31
+ context.helper(:request) { controller.request }
32
+ context.helper(:response) { @response || raise(Exception, "No response found") }
38
33
 
39
34
  context.setup(true) do
40
35
  self.class_eval { include RiotRails::ActionController::HttpMethods }
@@ -8,11 +8,10 @@ module RiotRails
8
8
  def delete(uri, params={}); perform_request("DELETE", uri, params); end
9
9
  private
10
10
  def perform_request(request_method, uri, params)
11
- http_reset
12
11
  params = params.inject({}) { |acc,(key,val)| acc[key] = val.to_s; acc }
13
12
  @env = ::Rack::MockRequest.env_for(uri, {:params => params, :method => request_method}).merge(@env)
14
13
  @env['action_dispatch.show_exceptions'] = false
15
- @app.call(@env)
14
+ @app.call(@env).tap { |state| @response = state.last }
16
15
  end
17
16
  end # HttpMethods
18
17
  end # ActionController
data/riot-rails.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{riot-rails}
8
- s.version = "0.2.0.pre.1"
8
+ s.version = "0.2.0.pre.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin 'Gus' Knowlden"]
12
- s.date = %q{2010-06-13}
12
+ s.date = %q{2010-06-15}
13
13
  s.description = %q{Riot specific test support for Rails apps. Protest the slow app.}
14
14
  s.email = %q{gus@gusg.us}
15
15
  s.extra_rdoc_files = [
@@ -20,15 +20,12 @@ context "ActionController middleware" do
20
20
  asserts("@env") { assigned(:@env) }.equals({})
21
21
  asserts("helper env") { topic.env }.equals { assigned(:@env) }
22
22
 
23
- asserts("helper controller") { topic.controller }.equals { assigned(:@controller) }
23
+ asserts("helper controller") do
24
+ topic.controller
25
+ end.raises(Exception, "Instance of controller not found")
24
26
 
25
- asserts("request before any request made") do
26
- topic.request
27
- end.raises(Exception, "No request made yet")
28
-
29
- asserts("response before any request made") do
30
- topic.response
31
- end.raises(Exception, "No response since no request made yet")
27
+ asserts(:request).raises(Exception, "Instance of controller not found")
28
+ asserts(:response).raises(Exception, "No response found")
32
29
 
33
30
  asserts_topic.responds_to(:get)
34
31
  asserts_topic.responds_to(:post)
@@ -59,8 +56,8 @@ context "ActionController middleware" do
59
56
  topic.env["action_controller.instance"]
60
57
  end.kind_of(RoomsController)
61
58
 
62
- asserts("helper request") { topic.request }.kind_of(Rack::Request)
63
- asserts("helper response") { topic.response }.kind_of(Rack::Response)
59
+ asserts(:request).kind_of(Rack::Request)
60
+ asserts(:response).kind_of(Rack::Response)
64
61
  end # post-request state
65
62
 
66
63
  end # ActionController middleware
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 2
8
8
  - 0
9
9
  - pre
10
- - 1
11
- version: 0.2.0.pre.1
10
+ - 2
11
+ version: 0.2.0.pre.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Justin 'Gus' Knowlden
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-06-13 00:00:00 -05:00
19
+ date: 2010-06-15 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency