riot 0.11.1 → 0.11.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/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ *0.11.2*
2
+
3
+ * [ISSUE] Options were not nesting. Now fixed. [jaknowlden]
4
+
1
5
  *0.11.1*
2
6
 
3
7
  * Middleware can now acts more like you would expect. Middleware now know the next neighbor in the chain and can do stuff to the context before and after the user-defined context is prepared. Removes support for the handle? method. Now we act more like a Rack app. [jaknowlden]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.1
1
+ 0.11.2
data/lib/riot/context.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Riot
2
- RootContext = Struct.new(:setups, :teardowns, :detailed_description)
2
+ RootContext = Struct.new(:setups, :teardowns, :detailed_description, :options)
3
3
 
4
4
  module ContextClassOverrides
5
5
  def assertion_class; Assertion; end
@@ -20,7 +20,10 @@ module Riot
20
20
  #
21
21
  # @return [Object]
22
22
  def option(key) options[key]; end
23
- private
23
+
24
+ # Returns the has of defined options.
25
+ #
26
+ # @return [Hash]
24
27
  def options; @options ||= {}; end
25
28
  end # ContextOptions
26
29
 
@@ -47,9 +50,10 @@ module Riot
47
50
  attr_reader :parent
48
51
 
49
52
  def initialize(description, parent=nil, &definition)
50
- @parent = parent || RootContext.new([],[], "")
53
+ @parent = parent || RootContext.new([],[], "", {})
51
54
  @description = description
52
55
  @contexts, @setups, @assertions, @teardowns = [], [], [], []
56
+ @options = @parent.options
53
57
  prepare_middleware(&definition)
54
58
  end
55
59
 
data/riot.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{riot}
8
- s.version = "0.11.1"
8
+ s.version = "0.11.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") 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-14}
13
13
  s.description = %q{An extremely fast, expressive, and context-driven unit-testing framework. A replacement for all other testing frameworks. Protest the slow test.}
14
14
  s.email = %q{gus@gusg.us}
15
15
  s.extra_rdoc_files = [
@@ -13,4 +13,21 @@ context "Context with options" do
13
13
  asserts("option :foo") { topic.option(:foo) }.equals("bar")
14
14
  asserts("option \"foo\"") { topic.option("foo") }.nil
15
15
  asserts("option \"bar\"") { topic.option("bar") }.equals(2)
16
+
17
+ context "and with a nested context" do
18
+ setup do
19
+ Riot::Context.new("Foo", topic) do
20
+ set :goo, "car"
21
+ set "car", 3
22
+ end
23
+ end
24
+
25
+ asserts_topic.responds_to(:option)
26
+
27
+ asserts("option :foo") { topic.option(:foo) }.equals("bar")
28
+ asserts("option \"bar\"") { topic.option("bar") }.equals(2)
29
+
30
+ asserts("option :goo") { topic.option(:goo) }.equals("car")
31
+ asserts("option \"car\"") { topic.option("car") }.equals(3)
32
+ end # and with a nested context
16
33
  end # Context with options
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 11
8
- - 1
9
- version: 0.11.1
8
+ - 2
9
+ version: 0.11.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Justin 'Gus' Knowlden
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-13 00:00:00 -05:00
17
+ date: 2010-06-14 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency