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

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,8 @@
1
- *0.2.0.pre.1*
1
+ *0.2.0.pre.3*
2
+
3
+ * ISSUE: Whelp, needed to account for parent contexts being ActionController handlers. Fixed [jaknowlden]
4
+
5
+ *0.2.0.pre.2*
2
6
 
3
7
  * 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
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0.pre.2
1
+ 0.2.0.pre.3
@@ -3,22 +3,25 @@ module RiotRails
3
3
  register
4
4
 
5
5
  def call(context)
6
- if handle?(context)
7
- setup_context_macros(context)
8
- setup_situation(context)
9
- end
6
+ setup_situation(context) if handle?(context.description)
7
+ setup_context_macros(context) if nested_handle?(context)
10
8
  middleware.call(context)
11
9
  end
12
10
  private
13
- def handle?(context)
14
- description = context.description
11
+ def handle?(description)
15
12
  description.kind_of?(Class) && description.ancestors.include?(::ActionController::Base)
16
13
  end
17
14
 
15
+ # Walking the description chain looking to see if any of them are serviceable
16
+ #
17
+ # TODO: see if we can't define a method on the context to observe instead of calling
18
+ # action_controller_description? each time
19
+ def nested_handle?(context)
20
+ (handle?(context.description) || nested_handle?(context.parent)) if context.respond_to?(:description)
21
+ end
22
+
18
23
  def setup_context_macros(context)
19
- context.class_eval do
20
- include RiotRails::ActionController::AssertsResponse
21
- end
24
+ context.class_eval { include RiotRails::ActionController::AssertsResponse }
22
25
  end
23
26
 
24
27
  def setup_situation(context)
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.2"
8
+ s.version = "0.2.0.pre.3"
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-15}
12
+ s.date = %q{2010-06-19}
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 = [
@@ -32,4 +32,13 @@ context "An asserts_response context macro" do
32
32
  asserts(:to_s).equals("asserts response #status")
33
33
  asserts("output of running the test") { topic.run(situation).first }.equals(:pass)
34
34
  end
35
+
36
+ context "used in the child context of an ActionController context" do
37
+ setup do
38
+ child_context = topic.context("child") {}
39
+ child_context.asserts_response.run(situation)
40
+ end
41
+
42
+ asserts_topic.equals([:pass, ""])
43
+ end # used in the child context of an ActionController context
35
44
  end # An asserts_response context macro
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 2
8
8
  - 0
9
9
  - pre
10
- - 2
11
- version: 0.2.0.pre.2
10
+ - 3
11
+ version: 0.2.0.pre.3
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-15 00:00:00 -05:00
19
+ date: 2010-06-19 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency