riot 0.10.13.pre → 0.10.13

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,4 +1,25 @@
1
- *0.10.13.pre*
1
+ *0.10.13*
2
+
3
+ * Helpers are now run with other setups, not separately. Which means you could use a helper in a setup. [jaknowlden]
4
+
5
+ context "Foo" do
6
+ helper(:user) { User.new }
7
+ setup do
8
+ Baz.new(:user => user) # :)
9
+ end
10
+ end # Foo
11
+
12
+ * Correctly report non-RR assertion failures and errors when RR is used [vandrijevik]
13
+
14
+ context "Foo.bar" do
15
+ asserts("baz is called") do
16
+ mock(Foo).baz
17
+ raise RuntimeError.new("oh noes")
18
+ end
19
+ end
20
+
21
+ would previously return [:fail, "baz() Called 0 times. Expected 1 times."], and will now
22
+ correctly return [:error, #<RuntimeError: oh noes>]
2
23
 
3
24
  * Recording description as is. Providing #detailed_description for proper behavior [jaknowlden]
4
25
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
 
4
- task :default => ["test:core"]
4
+ task :default => ["test:all"]
5
5
  task "test:all" => ["test:core", "test:extensions"]
6
6
 
7
7
  require 'rake/testtask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.13.pre
1
+ 0.10.13
@@ -23,7 +23,7 @@ module Riot
23
23
  def initialize(description, parent=nil, &definition)
24
24
  @parent = parent || RootContext.new([],[], "")
25
25
  @description = description
26
- @contexts, @helpers, @setups, @assertions, @teardowns = [], [], [], [], []
26
+ @contexts, @setups, @assertions, @teardowns = [], [], [], []
27
27
  self.instance_eval(&definition)
28
28
  end
29
29
 
@@ -62,7 +62,18 @@ module Riot
62
62
  (@setups << Setup.new(&definition)).last
63
63
  end
64
64
 
65
- def helper(name, &block); (@helpers << Helper.new(name, &block)).last; end
65
+ # Helpers are essentially methods accessible within a situation.
66
+ #
67
+ # They're not setup methods, but can be called from setups or from assetions. Each time called, the
68
+ # helper will be evaluated. It's not currently memoized.
69
+ #
70
+ # context "A string" do
71
+ # helper(:foo) { "bar" }
72
+ # asserts("a foo") { foo }.equals("bar")
73
+ # end
74
+ def helper(name, &block)
75
+ (@setups << Helper.new(name, &block)).last
76
+ end
66
77
 
67
78
  # A setup shortcut that returns the original topic so you don't have to. Good for nested setups. Instead
68
79
  # of doing this in your context:
@@ -136,13 +147,12 @@ module Riot
136
147
  private
137
148
 
138
149
  def runnables
139
- setups + @helpers + @assertions + teardowns
150
+ setups + @assertions + teardowns
140
151
  end
141
152
 
142
153
  def run_sub_contexts(reporter) @contexts.each { |ctx| ctx.run(reporter) }; end
143
154
 
144
155
  def new_context(description, klass, &definition)
145
- # (@contexts << klass.new("#{@description} #{description}", self, &definition)).last
146
156
  (@contexts << klass.new(description, self, &definition)).last
147
157
  end
148
158
 
@@ -13,7 +13,7 @@ module Riot
13
13
  situation.verify
14
14
  result
15
15
  rescue ::RR::Errors::RRError => e
16
- [:fail, e.message.gsub(/\n/, " ")]
16
+ result.first == :pass ? [:fail, e.message.gsub(/\n/, " ")] : result
17
17
  ensure
18
18
  situation.reset
19
19
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{riot}
8
- s.version = "0.10.13.pre"
8
+ s.version = "0.10.13"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
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-02-20}
12
+ s.date = %q{2010-03-01}
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 = [
@@ -11,11 +11,20 @@ context "Riot with RR support" do
11
11
  Riot::RR::Assertion.new("Satisfied") { true }.run(situation)
12
12
  end.equals([:pass, ""])
13
13
 
14
- asserts("assertion fails when RR is displeased") do
14
+ asserts("assertion that would otherwise pass fails with RR message when RR is displeased") do
15
15
  situation = Riot::RR::Situation.new
16
16
  Riot::RR::Assertion.new("Displeased") { mock!.hello }.run(situation)
17
17
  end.equals([:fail, "hello() Called 0 times. Expected 1 times."])
18
18
 
19
+ fake_exception = RuntimeError.new("ooga booga")
20
+ asserts("assertion that would otherwise fail or error does so intact even when RR is displeased") do
21
+ situation = Riot::RR::Situation.new
22
+ Riot::RR::Assertion.new("Displeased") do
23
+ mock!.hello
24
+ raise fake_exception
25
+ end.run(situation)
26
+ end.equals { [:error, fake_exception] }
27
+
19
28
  asserts("RR verification is reset between assertion runs") do
20
29
  situation = Riot::RR::Situation.new
21
30
  Riot::RR::Assertion.new("Displeased") { mock!.hello; mock!.what }.run(situation)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.13.pre
4
+ version: 0.10.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin 'Gus' Knowlden
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-20 00:00:00 -06:00
12
+ date: 2010-03-01 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -120,9 +120,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  version:
121
121
  required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ">"
123
+ - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: 1.3.1
125
+ version: "0"
126
126
  version:
127
127
  requirements: []
128
128