riot 0.9.7 → 0.9.8
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/.gitignore +2 -0
- data/README.markdown +31 -17
- data/Rakefile +33 -4
- data/VERSION +1 -0
- data/lib/riot.rb +11 -36
- data/lib/riot/assertion.rb +10 -11
- data/lib/riot/{macros.rb → assertion_macros.rb} +1 -1
- data/lib/riot/context.rb +20 -30
- data/lib/riot/errors.rb +15 -0
- data/lib/riot/report.rb +7 -6
- data/lib/riot/situation.rb +9 -0
- data/riot.gemspec +71 -37
- data/test/benchmark/riot_vs_minitest.rb +56 -0
- metadata +27 -11
data/.gitignore
ADDED
data/README.markdown
CHANGED
@@ -12,27 +12,40 @@ Then, simply install the Riot gem like so:
|
|
12
12
|
|
13
13
|
sudo gem install riot
|
14
14
|
|
15
|
-
|
15
|
+
#### Note on speed
|
16
16
|
|
17
17
|
I have done a really simple benchmarking (10,000 runs), but right now, Riot is running about **2 times** faster than Test::unit and thusly Shoulda:
|
18
18
|
|
19
|
-
$ ruby test/benchmark/simple_context_and_assertions.rb
|
20
|
-
|
21
19
|
Rehearsal ----------------------------------------------
|
22
|
-
Riot 0.
|
23
|
-
Test::Unit 1.
|
24
|
-
Shoulda 1.
|
25
|
-
------------------------------------- total: 3.
|
20
|
+
Riot 0.620000 0.010000 0.630000 ( 0.647318)
|
21
|
+
Test::Unit 1.500000 0.010000 1.510000 ( 1.508144)
|
22
|
+
Shoulda 1.490000 0.000000 1.490000 ( 1.501468)
|
23
|
+
------------------------------------- total: 3.630000sec
|
26
24
|
|
27
25
|
user system total real
|
28
|
-
Riot 0.
|
29
|
-
Test::Unit 1.
|
30
|
-
Shoulda 1.
|
31
|
-
|
32
|
-
Loaded suite test/benchmark/simple_context_and_assertions
|
26
|
+
Riot 0.630000 0.010000 0.640000 ( 0.640481)
|
27
|
+
Test::Unit 1.460000 0.000000 1.460000 ( 1.476454)
|
28
|
+
Shoulda 1.480000 0.010000 1.490000 ( 1.490633)
|
33
29
|
|
34
30
|
"Is it valid?", you ask. *I* think it is. I ain't no cheater, but I might be delusional.
|
35
31
|
|
32
|
+
To compare against MiniTest, I had to run the benchmark separately.
|
33
|
+
|
34
|
+
Rehearsal --------------------------------------------
|
35
|
+
Riot 0.630000 0.010000 0.640000 ( 0.641285)
|
36
|
+
MiniTest 0.770000 0.070000 0.840000 ( 0.846447)
|
37
|
+
----------------------------------- total: 1.480000sec
|
38
|
+
|
39
|
+
user system total real
|
40
|
+
Riot 0.630000 0.000000 0.630000 ( 0.632337)
|
41
|
+
MiniTest 0.730000 0.070000 0.800000 ( 0.798107)
|
42
|
+
|
43
|
+
Riot is currently only slightly faster, but I haven't done any optimization yet. Riot is also half the code of MiniTest (`313 loc < 674 loc` :)
|
44
|
+
|
45
|
+
All tests ran with `ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]`.
|
46
|
+
|
47
|
+
## Examples
|
48
|
+
|
36
49
|
#### Example: Basic booleans
|
37
50
|
|
38
51
|
**NOTE:** For no specific reason, I'm going to use an ActiveRecord model in the following examples.
|
@@ -256,13 +269,14 @@ Create or modify your existing Rakefile to define a test task like so:
|
|
256
269
|
desc 'Default task: run all tests'
|
257
270
|
task :default => [:test]
|
258
271
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
272
|
+
require 'rake/testtask'
|
273
|
+
Rake::TestTask.new(:test) do |test|
|
274
|
+
test.libs << 'lib' << 'test'
|
275
|
+
test.pattern = 'test/**/*_test.rb'
|
276
|
+
test.verbose = false
|
263
277
|
end
|
264
278
|
|
265
|
-
Then, from the command line, you only need to run `rake` or `rake test`. Please make sure to remove all references to any other testing frameworks before running tests. For instance, do not require `test/unit`, `shoulda`, `minitest`, or anything else like it.
|
279
|
+
Basically, it's like setting up any other test runner. Then, from the command line, you only need to run `rake` or `rake test`. Please make sure to remove all references to any other testing frameworks before running tests. For instance, do not require `test/unit`, `shoulda`, `minitest`, or anything else like it.
|
266
280
|
|
267
281
|
### With Sinatra
|
268
282
|
|
data/Rakefile
CHANGED
@@ -3,10 +3,11 @@ require 'rake'
|
|
3
3
|
|
4
4
|
task :default => [:test]
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
require 'rake/testtask'
|
7
|
+
Rake::TestTask.new(:test) do |test|
|
8
|
+
test.libs << 'lib' << 'test'
|
9
|
+
test.pattern = 'test/**/*_test.rb'
|
10
|
+
test.verbose = false
|
10
11
|
end
|
11
12
|
|
12
13
|
desc "Run Flog against library (except tests)"
|
@@ -23,3 +24,31 @@ desc "Run Roodi against library (except tests)"
|
|
23
24
|
task :roodi do
|
24
25
|
puts %x[find ./lib -name *.rb | xargs roodi]
|
25
26
|
end
|
27
|
+
|
28
|
+
desc "Stats on lines of code and test"
|
29
|
+
task :stats do
|
30
|
+
loc = %x[find ./lib -name *.rb | xargs cat | wc -l].strip.to_i
|
31
|
+
lotc = %x[find ./test -name *.rb | xargs cat | wc -l].strip.to_i
|
32
|
+
total, ratio = (loc + lotc), (lotc / loc.to_f)
|
33
|
+
|
34
|
+
fmt = " Code: %d\n Test: %d\n -----\n Total: %d Ratio (test/code): %f"
|
35
|
+
puts fmt % [loc, lotc, loc + lotc, ratio]
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Some monks like diamonds. I like gems.
|
40
|
+
|
41
|
+
begin
|
42
|
+
require 'jeweler'
|
43
|
+
Jeweler::Tasks.new do |gem|
|
44
|
+
gem.name = "riot"
|
45
|
+
gem.summary = "An extremely fast, expressive, and context-driven unit-testing framework. Protest the slow test."
|
46
|
+
gem.description = "An extremely fast, expressive, and context-driven unit-testing framework. A replacement for all other testing frameworks. Protest the slow test."
|
47
|
+
gem.email = "gus@gusg.us"
|
48
|
+
gem.homepage = "http://github.com/thumblemonks/riot"
|
49
|
+
gem.authors = ["Justin 'Gus' Knowlden"]
|
50
|
+
end
|
51
|
+
Jeweler::GemcutterTasks.new
|
52
|
+
rescue LoadError
|
53
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.8
|
data/lib/riot.rb
CHANGED
@@ -1,53 +1,28 @@
|
|
1
|
+
require 'riot/errors'
|
1
2
|
require 'riot/report'
|
3
|
+
require 'riot/situation'
|
2
4
|
require 'riot/context'
|
3
5
|
require 'riot/assertion'
|
4
|
-
require 'riot/
|
6
|
+
require 'riot/assertion_macros'
|
5
7
|
|
6
8
|
module Riot
|
7
9
|
|
8
|
-
|
9
|
-
reporter ||= self.reporter
|
10
|
-
context = Context.new(description, reporter, parent)
|
11
|
-
if block_given?
|
12
|
-
reporter.time { context.instance_eval(&block) }
|
13
|
-
context.report # Results get buffered this way, not necessarily the best
|
14
|
-
end
|
15
|
-
context
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
# Reporter
|
10
|
+
# Configuration
|
20
11
|
|
21
12
|
def self.reporter; @reporter ||= (Riot.silently? ? NilReport.new : TextReport.new); end
|
22
13
|
def self.reporter=(report); @reporter = report; end
|
23
14
|
def self.silently!; @silently = true; end
|
24
15
|
def self.silently?; @silently || false; end
|
25
16
|
|
26
|
-
|
27
|
-
reporter.results
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
at_exit { Riot.report unless Riot.silently? }
|
32
|
-
|
33
|
-
#
|
34
|
-
# Exceptions
|
35
|
-
|
36
|
-
class Failure < Exception
|
37
|
-
def print_stacktrace?; false; end
|
38
|
-
end
|
39
|
-
|
40
|
-
class Error < Failure
|
41
|
-
def initialize(message, error)
|
42
|
-
super(message)
|
43
|
-
set_backtrace(error.backtrace)
|
44
|
-
end
|
45
|
-
def print_stacktrace?; true; end
|
46
|
-
end
|
17
|
+
at_exit do
|
18
|
+
Riot.reporter.results
|
19
|
+
exit false unless reporter.passed?
|
20
|
+
end unless Riot.silently?
|
47
21
|
end # Riot
|
48
22
|
|
49
23
|
module Kernel
|
50
|
-
def context(
|
51
|
-
Riot.
|
24
|
+
def context(description, reporter = nil, parent = nil, &block)
|
25
|
+
reporter ||= Riot.reporter
|
26
|
+
reporter.time { Riot::Context.new(description, reporter, parent, &block) }
|
52
27
|
end
|
53
28
|
end # Kernel
|
data/lib/riot/assertion.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
module Riot
|
2
|
-
|
3
2
|
class Assertion
|
4
3
|
attr_reader :raised, :to_s, :description, :situation
|
5
|
-
def initialize(description, situation, &
|
4
|
+
def initialize(description, situation, &assertion_block)
|
6
5
|
@description = @to_s = description
|
7
6
|
@situation = situation
|
8
|
-
|
7
|
+
run(situation, &assertion_block)
|
9
8
|
end
|
10
9
|
|
11
10
|
def actual
|
12
|
-
|
11
|
+
unfail_if_default_failure_recorded
|
13
12
|
@actual
|
14
13
|
end
|
15
14
|
|
@@ -17,22 +16,22 @@ module Riot
|
|
17
16
|
@failure = Failure.new("#{description}: #{message}") unless errored?
|
18
17
|
end
|
19
18
|
|
19
|
+
def passed?; !(failed? || errored?); end
|
20
20
|
def failed?; !@failure.nil?; end
|
21
21
|
def errored?; !@raised.nil?; end
|
22
|
-
def
|
23
|
-
def result; @failure || error; end
|
22
|
+
def result; @failure || @raised; end
|
24
23
|
private
|
25
|
-
def
|
26
|
-
@actual = situation.instance_eval(&
|
24
|
+
def run(situation, &assertion_block)
|
25
|
+
@actual = situation.instance_eval(&assertion_block)
|
27
26
|
@default_failure = fail("expected true, not #{@actual.inspect}") unless @actual == true
|
28
27
|
rescue Failure => e
|
29
28
|
@failure = e
|
30
29
|
rescue Exception => e
|
31
|
-
@raised = e
|
30
|
+
@raised = Error.new("#{description}: errored with #{e}", e)
|
32
31
|
end
|
33
32
|
|
34
|
-
def
|
35
|
-
|
33
|
+
def unfail_if_default_failure_recorded
|
34
|
+
@default_failure = @failure = nil if @default_failure
|
36
35
|
end
|
37
36
|
end # Assertion
|
38
37
|
end # Riot
|
@@ -34,7 +34,7 @@ module Riot
|
|
34
34
|
# asserts("test") { raise My::Exception, "Foo Bar" }.raises(My::Exception, /Bar/)
|
35
35
|
# asserts("test") { raise My::Exception, ["a", "b"] }.raises(My::Exception, "ab")
|
36
36
|
def raises(expected, expected_message=nil)
|
37
|
-
actual_error = raised
|
37
|
+
actual_error = raised.original_exception
|
38
38
|
@raised = nil
|
39
39
|
return fail("should have raised #{expected}, but raised nothing") unless actual_error
|
40
40
|
return fail("should have raised #{expected}, not #{error.class}") unless expected == actual_error.class
|
data/lib/riot/context.rb
CHANGED
@@ -1,54 +1,44 @@
|
|
1
1
|
module Riot
|
2
|
-
class Situation
|
3
|
-
def fail(message)
|
4
|
-
raise Failure.new(message)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
2
|
class Context
|
9
3
|
# The protein
|
10
4
|
attr_reader :description, :assertions, :situation
|
11
|
-
def initialize(description, reporter, parent=nil)
|
12
|
-
@description, @reporter = description, reporter
|
5
|
+
def initialize(description, reporter, parent=nil, &context_block)
|
6
|
+
@description, @reporter, @parent = description, reporter, parent
|
13
7
|
@assertions = []
|
14
|
-
@parent = parent
|
15
8
|
@situation = Situation.new
|
16
9
|
bootstrap(@situation)
|
10
|
+
instance_eval(&context_block) if block_given? # running the context
|
11
|
+
report
|
17
12
|
end
|
18
13
|
|
14
|
+
# Walk it out. Call setup from parent first
|
19
15
|
def bootstrap(a_situation)
|
20
|
-
|
21
|
-
|
16
|
+
run_setup(a_situation, &@parent.bootstrap(a_situation)) if @parent
|
17
|
+
@setup
|
22
18
|
end
|
23
19
|
|
24
|
-
# something smelly between setup() and bootstrap()
|
25
|
-
def setup(&block)
|
26
|
-
@setup = block
|
27
|
-
make_situation_topical(induce_local_setup(situation))
|
28
|
-
end
|
29
|
-
|
30
|
-
# DSLee stuff
|
31
|
-
def context(description, &block) Riot.context(description, @reporter, self, &block); end
|
32
|
-
def asserts(description, &block) new_assertion("asserts #{description}", &block); end
|
33
|
-
def should(description, &block) new_assertion("should #{description}", &block); end
|
34
|
-
|
35
20
|
def report
|
36
21
|
assertions.each { |assertion| @reporter.process_assertion(assertion) }
|
37
22
|
end
|
38
23
|
|
39
24
|
def to_s; @to_s ||= [@parent.to_s, @description].join(' ').strip; end
|
40
|
-
|
41
|
-
|
42
|
-
|
25
|
+
|
26
|
+
# DSLee stuff
|
27
|
+
|
28
|
+
def setup(&block)
|
29
|
+
run_setup(situation, &(@setup = block))
|
43
30
|
end
|
44
31
|
|
45
|
-
def
|
46
|
-
|
32
|
+
def context(description, &block) Context.new(description, @reporter, self, &block); end
|
33
|
+
def asserts(what, &block) add_assertion("asserts #{what}", &block); end
|
34
|
+
def should(what, &block) add_assertion("should #{what}", &block); end
|
35
|
+
private
|
36
|
+
def add_assertion(what, &block)
|
37
|
+
(assertions << Assertion.new("#{to_s} #{what}", @situation, &block)).last
|
47
38
|
end
|
48
39
|
|
49
|
-
def
|
50
|
-
|
51
|
-
situation.instance_eval { def topic; @topic; end }
|
40
|
+
def run_setup(a_situation, &setup_block)
|
41
|
+
a_situation.topic = a_situation.instance_eval(&setup_block) if setup_block
|
52
42
|
end
|
53
43
|
end # Context
|
54
44
|
end # Riot
|
data/lib/riot/errors.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Riot
|
2
|
+
class Failure < Exception
|
3
|
+
def print_stacktrace?; false; end
|
4
|
+
end
|
5
|
+
|
6
|
+
class Error < Failure
|
7
|
+
attr_reader :original_exception
|
8
|
+
def initialize(message, raised)
|
9
|
+
super(message)
|
10
|
+
set_backtrace(raised.backtrace)
|
11
|
+
@original_exception = raised
|
12
|
+
end
|
13
|
+
def print_stacktrace?; true; end
|
14
|
+
end
|
15
|
+
end # Riot
|
data/lib/riot/report.rb
CHANGED
@@ -13,8 +13,9 @@ module Riot
|
|
13
13
|
|
14
14
|
def time(&block)
|
15
15
|
@start = Time.now
|
16
|
-
yield
|
16
|
+
result = yield
|
17
17
|
@time_taken += (Time.now - @start).to_f
|
18
|
+
result
|
18
19
|
end
|
19
20
|
|
20
21
|
def process_assertion(assertion)
|
@@ -63,19 +64,19 @@ module Riot
|
|
63
64
|
|
64
65
|
def results
|
65
66
|
@writer.puts "\n\n"
|
66
|
-
|
67
|
+
print_bad_results
|
67
68
|
format = "%d assertions, %d failures, %d errors in %s seconds"
|
68
69
|
@writer.puts format % [assertions, failures, errors, ("%0.6f" % time_taken)]
|
69
70
|
end
|
70
71
|
private
|
71
|
-
def
|
72
|
+
def print_bad_results
|
72
73
|
bad_results.each_with_index do |result, idx|
|
73
|
-
@writer.puts
|
74
|
+
@writer.puts format_result(idx + 1, result)
|
74
75
|
@writer.puts " " + result.backtrace.join("\n ") if result.print_stacktrace?
|
75
|
-
@writer.puts "\n
|
76
|
+
@writer.puts "\n"
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
79
|
-
def
|
80
|
+
def format_result(idx, result) "#%d - %s" % [idx, result.to_s]; end
|
80
81
|
end # TextReport
|
81
82
|
end # Riot
|
data/riot.gemspec
CHANGED
@@ -1,42 +1,76 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
s.summary = "An extremely fast, expressive, and context-driven unit-testing framework"
|
6
|
-
s.email = %w[gus@gusg.us]
|
7
|
-
s.homepage = "http://github.com/thumblemonks/protest"
|
8
|
-
s.description = "An extremely fast, expressive, and context-driven unit-testing framework. A replacement for all other testing frameworks. Protest the slow test."
|
9
|
-
s.authors = %w[Justin\ Knowlden]
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
10
5
|
|
11
|
-
|
12
|
-
s.
|
13
|
-
s.
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{riot}
|
8
|
+
s.version = "0.9.8"
|
14
9
|
|
15
|
-
|
16
|
-
s.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Justin 'Gus' Knowlden"]
|
12
|
+
s.date = %q{2009-10-10}
|
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
|
+
s.email = %q{gus@gusg.us}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.markdown"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"MIT-LICENSE",
|
21
|
+
"README.markdown",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/riot.rb",
|
25
|
+
"lib/riot/assertion.rb",
|
26
|
+
"lib/riot/assertion_macros.rb",
|
27
|
+
"lib/riot/context.rb",
|
28
|
+
"lib/riot/errors.rb",
|
29
|
+
"lib/riot/report.rb",
|
30
|
+
"lib/riot/situation.rb",
|
31
|
+
"riot.gemspec",
|
32
|
+
"test/assertion_macros/assertion_macro_assigns_test.rb",
|
33
|
+
"test/assertion_macros/assertion_macro_equals_test.rb",
|
34
|
+
"test/assertion_macros/assertion_macro_exists_test.rb",
|
35
|
+
"test/assertion_macros/assertion_macro_kind_of_test.rb",
|
36
|
+
"test/assertion_macros/assertion_macro_matching_test.rb",
|
37
|
+
"test/assertion_macros/assertion_macro_nil_test.rb",
|
38
|
+
"test/assertion_macros/assertion_macro_raises_test.rb",
|
39
|
+
"test/assertion_macros/assertion_macro_respond_to_test.rb",
|
40
|
+
"test/assertion_test.rb",
|
41
|
+
"test/benchmark/riot_vs_minitest.rb",
|
42
|
+
"test/benchmark/simple_context_and_assertions.rb",
|
43
|
+
"test/context_test.rb",
|
44
|
+
"test/teststrap.rb"
|
25
45
|
]
|
26
|
-
|
27
|
-
s.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
test/assertion_macros/
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
46
|
+
s.homepage = %q{http://github.com/thumblemonks/riot}
|
47
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
48
|
+
s.require_paths = ["lib"]
|
49
|
+
s.rubygems_version = %q{1.3.5}
|
50
|
+
s.summary = %q{An extremely fast, expressive, and context-driven unit-testing framework. Protest the slow test.}
|
51
|
+
s.test_files = [
|
52
|
+
"test/assertion_macros/assertion_macro_assigns_test.rb",
|
53
|
+
"test/assertion_macros/assertion_macro_equals_test.rb",
|
54
|
+
"test/assertion_macros/assertion_macro_exists_test.rb",
|
55
|
+
"test/assertion_macros/assertion_macro_kind_of_test.rb",
|
56
|
+
"test/assertion_macros/assertion_macro_matching_test.rb",
|
57
|
+
"test/assertion_macros/assertion_macro_nil_test.rb",
|
58
|
+
"test/assertion_macros/assertion_macro_raises_test.rb",
|
59
|
+
"test/assertion_macros/assertion_macro_respond_to_test.rb",
|
60
|
+
"test/assertion_test.rb",
|
61
|
+
"test/benchmark/riot_vs_minitest.rb",
|
62
|
+
"test/benchmark/simple_context_and_assertions.rb",
|
63
|
+
"test/context_test.rb",
|
64
|
+
"test/teststrap.rb"
|
41
65
|
]
|
66
|
+
|
67
|
+
if s.respond_to? :specification_version then
|
68
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
69
|
+
s.specification_version = 3
|
70
|
+
|
71
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
72
|
+
else
|
73
|
+
end
|
74
|
+
else
|
75
|
+
end
|
42
76
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
$:.concat ['./lib']
|
2
|
+
require 'benchmark'
|
3
|
+
|
4
|
+
#
|
5
|
+
# Model
|
6
|
+
|
7
|
+
class Room
|
8
|
+
attr_reader :name
|
9
|
+
def initialize(name)
|
10
|
+
@name = name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# Riot
|
16
|
+
|
17
|
+
require 'riot'
|
18
|
+
Riot.silently!
|
19
|
+
|
20
|
+
#
|
21
|
+
# MiniTest::Unit
|
22
|
+
|
23
|
+
require 'rubygems'
|
24
|
+
require 'minitest/unit'
|
25
|
+
|
26
|
+
class RoomTest < MiniTest::Unit::TestCase
|
27
|
+
def setup
|
28
|
+
@room = Room.new("bed")
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_room_should_be_named_bed
|
32
|
+
assert_equal "bed", @room.name
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Benchmarking
|
38
|
+
|
39
|
+
n = 100 * 100
|
40
|
+
|
41
|
+
Benchmark.bmbm do |x|
|
42
|
+
x.report("Riot") do
|
43
|
+
n.times do
|
44
|
+
context "a room" do
|
45
|
+
setup { Room.new("bed") }
|
46
|
+
|
47
|
+
asserts("name") { topic.name }.equals("bed")
|
48
|
+
end # a room
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
x.report("MiniTest") do
|
53
|
+
n.times { RoomTest.new("Blah").run(MiniTest::Unit.new) }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
metadata
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Justin Knowlden
|
7
|
+
- Justin 'Gus' Knowlden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: An extremely fast, expressive, and context-driven unit-testing framework. A replacement for all other testing frameworks. Protest the slow test.
|
17
|
-
email:
|
18
|
-
- gus@gusg.us
|
17
|
+
email: gus@gusg.us
|
19
18
|
executables: []
|
20
19
|
|
21
20
|
extensions: []
|
@@ -23,22 +22,39 @@ extensions: []
|
|
23
22
|
extra_rdoc_files:
|
24
23
|
- README.markdown
|
25
24
|
files:
|
25
|
+
- .gitignore
|
26
26
|
- MIT-LICENSE
|
27
27
|
- README.markdown
|
28
|
+
- Rakefile
|
29
|
+
- VERSION
|
28
30
|
- lib/riot.rb
|
29
31
|
- lib/riot/assertion.rb
|
32
|
+
- lib/riot/assertion_macros.rb
|
30
33
|
- lib/riot/context.rb
|
31
|
-
- lib/riot/
|
34
|
+
- lib/riot/errors.rb
|
32
35
|
- lib/riot/report.rb
|
36
|
+
- lib/riot/situation.rb
|
33
37
|
- riot.gemspec
|
38
|
+
- test/assertion_macros/assertion_macro_assigns_test.rb
|
39
|
+
- test/assertion_macros/assertion_macro_equals_test.rb
|
40
|
+
- test/assertion_macros/assertion_macro_exists_test.rb
|
41
|
+
- test/assertion_macros/assertion_macro_kind_of_test.rb
|
42
|
+
- test/assertion_macros/assertion_macro_matching_test.rb
|
43
|
+
- test/assertion_macros/assertion_macro_nil_test.rb
|
44
|
+
- test/assertion_macros/assertion_macro_raises_test.rb
|
45
|
+
- test/assertion_macros/assertion_macro_respond_to_test.rb
|
46
|
+
- test/assertion_test.rb
|
47
|
+
- test/benchmark/riot_vs_minitest.rb
|
48
|
+
- test/benchmark/simple_context_and_assertions.rb
|
49
|
+
- test/context_test.rb
|
50
|
+
- test/teststrap.rb
|
34
51
|
has_rdoc: true
|
35
|
-
homepage: http://github.com/thumblemonks/
|
52
|
+
homepage: http://github.com/thumblemonks/riot
|
36
53
|
licenses: []
|
37
54
|
|
38
55
|
post_install_message:
|
39
56
|
rdoc_options:
|
40
|
-
- --
|
41
|
-
- README.markdown
|
57
|
+
- --charset=UTF-8
|
42
58
|
require_paths:
|
43
59
|
- lib
|
44
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -59,9 +75,8 @@ rubyforge_project:
|
|
59
75
|
rubygems_version: 1.3.5
|
60
76
|
signing_key:
|
61
77
|
specification_version: 3
|
62
|
-
summary: An extremely fast, expressive, and context-driven unit-testing framework
|
78
|
+
summary: An extremely fast, expressive, and context-driven unit-testing framework. Protest the slow test.
|
63
79
|
test_files:
|
64
|
-
- Rakefile
|
65
80
|
- test/assertion_macros/assertion_macro_assigns_test.rb
|
66
81
|
- test/assertion_macros/assertion_macro_equals_test.rb
|
67
82
|
- test/assertion_macros/assertion_macro_exists_test.rb
|
@@ -71,6 +86,7 @@ test_files:
|
|
71
86
|
- test/assertion_macros/assertion_macro_raises_test.rb
|
72
87
|
- test/assertion_macros/assertion_macro_respond_to_test.rb
|
73
88
|
- test/assertion_test.rb
|
89
|
+
- test/benchmark/riot_vs_minitest.rb
|
74
90
|
- test/benchmark/simple_context_and_assertions.rb
|
75
91
|
- test/context_test.rb
|
76
92
|
- test/teststrap.rb
|