rubytest 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 74e1fac06f06bdac2b565ff5e50d26ed55939031
4
+ data.tar.gz: 6f69652075d71103e5905d28ecdbdd1cea8ef1ec
5
+ SHA512:
6
+ metadata.gz: 7931495754a8ae4c102274dafdbda4cbd0f5e2f9c63b3bb6bac5acbe35c9fb860e7915f576637cff072c17da1ecd7871222a0251d02a20aec8561e8e9ae83e14
7
+ data.tar.gz: 8af87ee70f52ca63287b5f338523384bd9d622978202214cb6f14a8959f0df424e71469f78518f0d3c12a1870e984f65383c6ddc4ac440bee3b0a4f153b4e86f
data/.index CHANGED
@@ -2,28 +2,20 @@
2
2
  revision: 2013
3
3
  type: ruby
4
4
  sources:
5
- - var
5
+ - Indexfile
6
+ - Gemfile
6
7
  authors:
7
8
  - name: trans
8
9
  email: transfire@gmail.com
9
10
  organizations: []
10
11
  requirements:
11
- - name: ansi
12
- - groups:
13
- - build
14
- development: true
15
- name: fire
16
- - groups:
17
- - build
18
- development: true
19
- name: detroit
20
12
  - groups:
21
13
  - test
22
- development: true
14
+ version: '>= 0'
23
15
  name: qed
24
16
  - groups:
25
17
  - test
26
- development: true
18
+ version: '>= 0'
27
19
  name: ae
28
20
  conflicts: []
29
21
  alternatives: []
@@ -50,12 +42,13 @@ customs: []
50
42
  paths:
51
43
  lib:
52
44
  - lib
53
- created: '2011-07-23'
54
- summary: Ruby Universal Test Harness
55
- title: Ruby Test
56
- version: 0.7.0
57
45
  name: rubytest
58
- description: ! "Ruby Test is a universal test harness for Ruby. It can handle any
59
- compliant \ntest framework, even running tests from multiple frameworks in a single
60
- pass."
61
- date: '2013-02-17'
46
+ title: Rubytest
47
+ version: 0.8.0
48
+ summary: Ruby Universal Test Harness
49
+ description: Rubytest is a universal test harness for Ruby. It can handle any compliant
50
+ test framework, even running tests from multiple frameworks in a single pass. This
51
+ is the core component of the system, and is the only part strictly necessary to
52
+ run tests.
53
+ created: '2011-07-23'
54
+ date: '2014-07-18'
data/HISTORY.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # RELEASE HISTORY
2
2
 
3
+ ## 0.8.0 / 2014-07-18
4
+
5
+ We have whittled Rubytest down to it core functionaltiy and spun the rest
6
+ off as separate plugin gems. The rubytest-suite gem is a metapackage
7
+ loading this gem and a set of common plugins for convenience.
8
+
9
+ Changes:
10
+
11
+ * Spin-off report formats as separate gems.
12
+ * Create rubytest-suite gem for convenience.
13
+
14
+
3
15
  ## 0.7.0 / 2013-02-18
4
16
 
5
17
  Version 0.7 is a significant release. The library has been simplified
@@ -1,33 +1,23 @@
1
- # COPYRIGHT NOTICES
2
-
3
- ## Ruby Test
4
-
5
- **Project** | Ruby Test
6
- --------------|------------------------------------------
7
- **Website** | http://rubyworks.github.com/ruby-test
8
- **License** | BSD-2-Clause
9
- **Copyright** | (c) 2011 Rubyworks
10
-
11
- Copyright 2011 Rubyworks. All rights reserved.
12
-
13
- Redistribution and use in source and binary forms, with or without
14
- modification, are permitted provided that the following conditions are met:
15
-
16
- 1. Redistributions of source code must retain the above copyright notice,
17
- this list of conditions and the following disclaimer.
18
-
19
- 2. Redistributions in binary form must reproduce the above copyright
20
- notice, this list of conditions and the following disclaimer in the
21
- documentation and/or other materials provided with the distribution.
22
-
23
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
25
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
- COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ (BSD-2-Clause License)
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice,
7
+ this list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
14
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
15
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
16
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
17
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
20
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
23
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ruby Test
1
+ # Rubytest
2
2
 
3
3
  [Homepage](http://rubyworks.github.com/rubytest) /
4
4
  [User Guide](http://wiki.github.com/rubyworks/rubytest) /
@@ -11,25 +11,27 @@
11
11
 
12
12
  ## Description
13
13
 
14
- Ruby Test is a universal test harness for Ruby developers. It can be used
15
- by any Ruby test framework. You can think of Ruby Test as a *meta test framework*.
16
- Ruby Test defines a straight-forward specification that any test framework
17
- can utilize as it back-end. This makes it almost trivial to implement new
18
- test frameworks. Ruby Test further allows tests from various frameworks
19
- to all run through a single uniform user interface in a single pass.
14
+ Rubytest is a universal test harness for Ruby development. Think
15
+ of Rubytest as a *testing meta-framework*. It defines a straight-forward
16
+ specification that anyone can use to create their own testing DSLs
17
+ quickily and easily. This can be used for testing end applcations or it
18
+ can be used by test framework as a backend.
19
+ In addition, since all Rubytest controls the backend, multiple frameworks
20
+ can be used in a single test suite all of which can run through a single
21
+ uniform interface in a process.
20
22
 
21
23
 
22
24
  ## Specification
23
25
 
24
26
  The universal access point for testing is the `$TEST_SUITE` global array. A test
25
27
  framework need only add compliant test objects to `$TEST_SUITE`.
26
- Ruby Test will iterate through these objects. If a test object responds to
28
+ Rubytest will iterate through these objects. If a test object responds to
27
29
  `#call`, it is run as a test procedure. If it responds to `#each` it is iterated
28
30
  over as a test case with each entry handled in the same manner. All test
29
31
  objects must respond to `#to_s` so their description can be used in test
30
32
  reports.
31
33
 
32
- Ruby Test handles assertions with [BRASS](http://rubyworks.github.com/brass)
34
+ Rubytest handles assertions with [BRASS](http://rubyworks.github.com/brass)
33
35
  compliance. Any raised exception that responds to `#assertion?` in the
34
36
  affirmative is taken to be a failed assertion rather than simply an error.
35
37
  A test framework may raise a `NotImplementedError` to have a test recorded
@@ -40,18 +42,18 @@ to indicate the urgency of the pending test. Priorities of -1 or lower
40
42
  will generally not be brought to the attention of testers unless explicitly
41
43
  configured to do so.
42
44
 
43
- That is the crux of Ruby Test specification. Ruby Test supports some
45
+ That is the crux of Rubytest specification. Rubytest supports some
44
46
  additional features that can makes its usage even more convenient.
45
47
  See the [Wiki](http://github.com/rubyworks/test/wiki) for further details.
46
48
 
47
49
 
48
50
  ## Installation
49
51
 
50
- Ruby Test is available as a Gem package.
52
+ Rubytest is available as a Gem package.
51
53
 
52
54
  $ gem install rubytest
53
55
 
54
- Ruby Test is compliant with Setup.rb layout standard, so it can
56
+ Rubytest is compliant with Setup.rb layout standard, so it can
55
57
  also be installed in an FHS compliant fashion if necessary.
56
58
 
57
59
 
@@ -59,30 +61,11 @@ also be installed in an FHS compliant fashion if necessary.
59
61
 
60
62
  There are a few ways to run tests.
61
63
 
62
- ### Via Runner Scripts
63
-
64
- Out of the box Ruby Test doesn't provide any special means for doing so,
65
- you simply write you own runner script using the Ruby Test API.
66
- Here is the basic example:
67
-
68
- require 'rubytest'
69
-
70
- Test.run! do |r|
71
- r.loadpath 'lib'
72
- r.test_files 'test/test_*.rb'
73
- end
74
-
75
- Put that in a `test/runner.rb` script and run it with `ruby` or
76
- add `#!/usr/bin/env ruby` at the top and put it in `bin/test`
77
- setting `chmod u+x bin/test`. Either way, you now have your test
78
- runner.
79
-
80
64
  ### Via Command-line Tool
81
65
 
82
- Probably the easiest way to run tests is via the command line tool available
83
- via the `rubytest-cli` plug-in. You can read more about it on its
84
- [webpage](http://rubyworks.github.com/rubytest-cli), but we will quickly go
85
- over it here.
66
+ The easiest way to run tests is via the command line tool. You can read more about
67
+ it on its [manpage](http://rubyworks.github.com/rubytest/man/rubytest.1.html),
68
+ but we will quickly go over it here.
86
69
 
87
70
  The basic usage example is:
88
71
 
@@ -116,10 +99,28 @@ A basic example in its case, add to ones Rakefile:
116
99
 
117
100
  See the Wiki for more detailed information on the different ways to run tests.
118
101
 
102
+ ### Via Runner Scripts
103
+
104
+ Out of the box Rubytest doesn't provide any special means for doing so,
105
+ you simply write you own runner script using the Rubytest API.
106
+ Here is the basic example:
107
+
108
+ require 'rubytest'
109
+
110
+ Test.run! do |r|
111
+ r.loadpath 'lib'
112
+ r.test_files 'test/test_*.rb'
113
+ end
114
+
115
+ Put that in a `test/runner.rb` script and run it with `ruby` or
116
+ add `#!/usr/bin/env ruby` at the top and put it in `bin/test`
117
+ setting `chmod u+x bin/test`. Either way, you now have your test
118
+ runner.
119
+
119
120
 
120
121
  ## Requirements
121
122
 
122
- Ruby Test uses the [ANSI](http://rubyworks.github.com/ansi) gem for color output.
123
+ Rubytest uses the [ANSI](http://rubyworks.github.com/ansi) gem for color output.
123
124
 
124
125
  Because of the "foundational" nature of this library we will look at removing
125
126
  this dependency for future versions, but for early development the
@@ -128,9 +129,9 @@ requirements does the job and does it well.
128
129
 
129
130
  ## Development
130
131
 
131
- Ruby Test is still a bit of a "nuby" gem. Please feel OBLIGATED to help improve it ;-)
132
+ Rubytest is still a bit of a "nuby" gem. Please feel OBLIGATED to help improve it ;-)
132
133
 
133
- Ruby Test is a [Rubyworks](http://rubyworks.github.com) project. If you can't
134
+ Rubytest is a [Rubyworks](http://rubyworks.github.com) project. If you can't
134
135
  contribute code, you can still help out by contributing to our development fund.
135
136
 
136
137
 
@@ -30,9 +30,8 @@ if RUBY_VERSION < '1.9'
30
30
  require 'rubytest/recorder'
31
31
  require 'rubytest/advice'
32
32
  require 'rubytest/runner'
33
- require 'rubytest/cli'
34
- require 'rubytest/reporters/abstract'
35
- require 'rubytest/reporters/abstract_hash'
33
+ require 'rubytest/format/abstract'
34
+ require 'rubytest/format/abstract_hash'
36
35
  else
37
36
  require_relative 'rubytest/core_ext'
38
37
  require_relative 'rubytest/code_snippet'
@@ -40,8 +39,7 @@ else
40
39
  require_relative 'rubytest/recorder'
41
40
  require_relative 'rubytest/advice'
42
41
  require_relative 'rubytest/runner'
43
- require_relative 'rubytest/cli'
44
- require_relative 'rubytest/reporters/abstract'
45
- require_relative 'rubytest/reporters/abstract_hash'
42
+ require_relative 'rubytest/format/abstract'
43
+ require_relative 'rubytest/format/abstract_hash'
46
44
  end
47
45
 
@@ -2,28 +2,20 @@
2
2
  revision: 2013
3
3
  type: ruby
4
4
  sources:
5
- - var
5
+ - Indexfile
6
+ - Gemfile
6
7
  authors:
7
8
  - name: trans
8
9
  email: transfire@gmail.com
9
10
  organizations: []
10
11
  requirements:
11
- - name: ansi
12
- - groups:
13
- - build
14
- development: true
15
- name: fire
16
- - groups:
17
- - build
18
- development: true
19
- name: detroit
20
12
  - groups:
21
13
  - test
22
- development: true
14
+ version: '>= 0'
23
15
  name: qed
24
16
  - groups:
25
17
  - test
26
- development: true
18
+ version: '>= 0'
27
19
  name: ae
28
20
  conflicts: []
29
21
  alternatives: []
@@ -50,12 +42,13 @@ customs: []
50
42
  paths:
51
43
  lib:
52
44
  - lib
53
- created: '2011-07-23'
54
- summary: Ruby Universal Test Harness
55
- title: Ruby Test
56
- version: 0.7.0
57
45
  name: rubytest
58
- description: ! "Ruby Test is a universal test harness for Ruby. It can handle any
59
- compliant \ntest framework, even running tests from multiple frameworks in a single
60
- pass."
61
- date: '2013-02-17'
46
+ title: Rubytest
47
+ version: 0.8.0
48
+ summary: Ruby Universal Test Harness
49
+ description: Rubytest is a universal test harness for Ruby. It can handle any compliant
50
+ test framework, even running tests from multiple frameworks in a single pass. This
51
+ is the core component of the system, and is the only part strictly necessary to
52
+ run tests.
53
+ created: '2011-07-23'
54
+ date: '2014-07-18'
@@ -1,7 +1,7 @@
1
1
  require 'rubytest'
2
2
 
3
3
  at_exit {
4
- success = Test.run
4
+ success = Test.run!(ENV['profile'] || ENV['p'])
5
5
  exit -1 unless success
6
6
  }
7
7
 
@@ -116,7 +116,15 @@ module Test
116
116
 
117
117
  #apply_environment
118
118
 
119
- apply(settings, &block)
119
+ apply(settings)
120
+
121
+ # save for lazy execution
122
+ @block = block
123
+ end
124
+
125
+ # Apply lazy block.
126
+ def apply!
127
+ @block.call(self) if @block
120
128
  end
121
129
 
122
130
  # Evaluate configuration block.
@@ -129,6 +137,16 @@ module Test
129
137
  block.call(self) if block
130
138
  end
131
139
 
140
+ #
141
+ def name
142
+ @name
143
+ end
144
+
145
+ #
146
+ def name=(name)
147
+ @name = name.to_s if name
148
+ end
149
+
132
150
  # Default test suite ($TEST_SUITE).
133
151
  #
134
152
  # @return [Array]
@@ -351,6 +369,8 @@ module Test
351
369
  # Convert configuration to shell options, compatible with the
352
370
  # rubytest command line.
353
371
  #
372
+ # DEPRECATE: Shell command is considered bad approach.
373
+ #
354
374
  # @return [Array<String>]
355
375
  def to_shellwords
356
376
  argv = []
@@ -55,7 +55,9 @@ module Test
55
55
  else Test.configuration(config)
56
56
  end
57
57
 
58
- yeild(@config) if block_given?
58
+ @config.apply! # apply lazy config block
59
+
60
+ yield(@config) if block_given?
59
61
 
60
62
  @advice = Advice.new
61
63
  end
@@ -281,29 +283,36 @@ module Test
281
283
  def reporter_load(format)
282
284
  format = DEFAULT_REPORT_FORMAT unless format
283
285
  format = format.to_s.downcase
284
- name = reporter_list.find{ |r| /^#{format}/ =~ r }
285
-
286
- raise "unsupported report format" unless format
286
+ name = reporter_list.find{ |r| /^#{format}/ =~ r } || format
287
287
 
288
- if RUBY_VERSION < '1.9'
289
- require "rubytest/reporters/#{name}"
290
- else
291
- require_relative "reporters/#{name}"
288
+ begin
289
+ require "rubytest/format/#{name}"
290
+ rescue LoadError
291
+ raise "mistyped or uninstalled report format" unless format
292
292
  end
293
293
 
294
294
  reporter = Test::Reporters.const_get(name.capitalize)
295
295
  reporter.new(self)
296
296
  end
297
297
 
298
+ # List of known report formats.
299
+ #
300
+ # TODO: Could use finder gem to look these up, but that's yet another dependency.
301
+ #
302
+ KNOWN_FORMATS = %w{
303
+ dotprogress html progress outline summary tap tapy tapj test
304
+ }
305
+
298
306
  # Returns a list of available report types.
299
307
  #
300
308
  # @return [Array<String>]
301
309
  # The names of available reporters.
302
310
  def reporter_list
303
- list = Dir[File.dirname(__FILE__) + '/reporters/*.rb']
304
- list = list.map{ |r| File.basename(r).chomp('.rb') }
305
- list = list.reject{ |r| /^abstract/ =~ r }
306
- list.sort
311
+ return KNOWN_FORMATS.sort
312
+ #list = Dir[File.dirname(__FILE__) + '/reporters/*.rb']
313
+ #list = list.map{ |r| File.basename(r).chomp('.rb') }
314
+ #list = list.reject{ |r| /^abstract/ =~ r }
315
+ #list.sort
307
316
  end
308
317
 
309
318
  # Files can be globs and directories which need to be