assert 2.0.3 → 2.1.0
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/README.md +5 -9
- data/lib/assert/cli.rb +1 -1
- data/lib/assert/runner.rb +1 -2
- data/lib/assert/test.rb +1 -1
- data/lib/assert/version.rb +1 -1
- data/lib/assert.rb +6 -6
- data/test/helper.rb +1 -1
- data/test/unit/assert_tests.rb +1 -1
- data/test/unit/test_tests.rb +3 -3
- metadata +4 -4
data/README.md
CHANGED
@@ -89,7 +89,7 @@ Assert uses a config pattern for specifying settings. Using this pattern, you c
|
|
89
89
|
|
90
90
|
### User settings
|
91
91
|
|
92
|
-
Assert will look for and require the file `$HOME/.assert/
|
92
|
+
Assert will look for and require the file `$HOME/.assert/init.rb`. Use this file to specify user settings. User settings can be overridden by Local, CLI, and ENV settings.
|
93
93
|
|
94
94
|
### Local settings
|
95
95
|
|
@@ -161,22 +161,22 @@ Using an ENV var:
|
|
161
161
|
$ ASSERT_RUNNER_SEED=1234 assert
|
162
162
|
```
|
163
163
|
|
164
|
-
###
|
164
|
+
### Capture Output
|
165
165
|
|
166
|
-
By default, Assert shows any output on `$stdout` produced while running a test. It provides a setting to override whether to show this output or to 'capture' it and
|
166
|
+
By default, Assert shows any output on `$stdout` produced while running a test. It provides a setting to override whether to show this output or to 'capture' it and display it in the test result details:
|
167
167
|
|
168
168
|
In user/local settings file:
|
169
169
|
|
170
170
|
```ruby
|
171
171
|
Assert.configure do |config|
|
172
|
-
config.
|
172
|
+
config.capture_output true
|
173
173
|
end
|
174
174
|
```
|
175
175
|
|
176
176
|
Using the CLI:
|
177
177
|
|
178
178
|
```sh
|
179
|
-
$ assert [-o|--
|
179
|
+
$ assert [-o|--capture-output|--no-capture-output]
|
180
180
|
```
|
181
181
|
|
182
182
|
### Failure Handling
|
@@ -310,10 +310,6 @@ A `View` object is responsible for rendering test result output. Assert provide
|
|
310
310
|
|
311
311
|
Macros are procs that define sets of test code and make it available for easy reuse. Macros work nicely with the 'should' and 'test' context methods.
|
312
312
|
|
313
|
-
## The Assert family of testing tools
|
314
|
-
|
315
|
-
TODO: add in references to assert related tools.
|
316
|
-
|
317
313
|
## Installation
|
318
314
|
|
319
315
|
```
|
data/lib/assert/cli.rb
CHANGED
@@ -15,7 +15,7 @@ module Assert
|
|
15
15
|
option 'runner_seed', 'Use a given seed to run tests', {
|
16
16
|
:abbrev => 's', :value => Fixnum
|
17
17
|
}
|
18
|
-
option '
|
18
|
+
option 'capture_output', 'capture stdout and display in result details', {
|
19
19
|
:abbrev => 'o'
|
20
20
|
}
|
21
21
|
option 'halt_on_fail', 'halt a test when it fails', {
|
data/lib/assert/runner.rb
CHANGED
@@ -11,7 +11,6 @@ module Assert
|
|
11
11
|
suite.setup
|
12
12
|
|
13
13
|
suite.start_time = Time.now
|
14
|
-
# TODO: parallel running
|
15
14
|
tests_to_run(suite).each do |test|
|
16
15
|
view.fire(:before_test, test)
|
17
16
|
test.run{ |result| view.fire(:on_result, result) }
|
@@ -28,7 +27,7 @@ module Assert
|
|
28
27
|
protected
|
29
28
|
|
30
29
|
def tests_to_run(suite)
|
31
|
-
srand Assert.config.runner_seed
|
30
|
+
srand Assert.config.runner_seed
|
32
31
|
suite.tests.sort.sort_by { rand suite.tests.size }
|
33
32
|
end
|
34
33
|
|
data/lib/assert/test.rb
CHANGED
data/lib/assert/version.rb
CHANGED
data/lib/assert.rb
CHANGED
@@ -46,7 +46,7 @@ module Assert
|
|
46
46
|
end
|
47
47
|
|
48
48
|
settings :view, :suite, :runner, :test_dir, :test_helper
|
49
|
-
settings :runner_seed, :
|
49
|
+
settings :runner_seed, :capture_output, :halt_on_fail, :debug
|
50
50
|
|
51
51
|
def initialize
|
52
52
|
@view = Assert::View::DefaultView.new($stdout)
|
@@ -55,11 +55,11 @@ module Assert
|
|
55
55
|
@test_dir = "test"
|
56
56
|
@test_helper = "helper.rb"
|
57
57
|
|
58
|
-
#
|
59
|
-
@runner_seed
|
60
|
-
@
|
61
|
-
@halt_on_fail
|
62
|
-
@debug
|
58
|
+
# default settings
|
59
|
+
@runner_seed = begin; srand; srand % 0xFFFF; end.to_i
|
60
|
+
@capture_output = true
|
61
|
+
@halt_on_fail = true
|
62
|
+
@debug = false
|
63
63
|
end
|
64
64
|
|
65
65
|
def apply(settings)
|
data/test/helper.rb
CHANGED
@@ -14,7 +14,7 @@ require 'pry'
|
|
14
14
|
class Assert::Context
|
15
15
|
def setup
|
16
16
|
Assert.config.halt_on_fail false
|
17
|
-
# Note: don't mess with the `
|
17
|
+
# Note: don't mess with the `capture_output` setting in this setup block. Doing
|
18
18
|
# so will break the capture output tests. If you really need to set it one
|
19
19
|
# way or the other, do so in the `.assert.rb` local settings file.
|
20
20
|
end
|
data/test/unit/assert_tests.rb
CHANGED
@@ -31,7 +31,7 @@ module Assert
|
|
31
31
|
subject { Config }
|
32
32
|
|
33
33
|
should have_imeths :suite, :view, :runner, :test_dir, :test_helper
|
34
|
-
should have_imeths :runner_seed, :
|
34
|
+
should have_imeths :runner_seed, :capture_output, :halt_on_fail, :debug
|
35
35
|
should have_imeths :apply
|
36
36
|
|
37
37
|
should "default the view, suite, and runner" do
|
data/test/unit/test_tests.rb
CHANGED
@@ -161,11 +161,11 @@ class Assert::Test
|
|
161
161
|
puts "std out from the test"
|
162
162
|
assert true
|
163
163
|
}
|
164
|
-
@
|
165
|
-
Assert.config.
|
164
|
+
@orig_capture = Assert.config.capture_output
|
165
|
+
Assert.config.capture_output true
|
166
166
|
end
|
167
167
|
teardown do
|
168
|
-
Assert.config.
|
168
|
+
Assert.config.capture_output @orig_capture
|
169
169
|
end
|
170
170
|
|
171
171
|
should "capture any io from the test" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.3
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly Redding
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-04-25 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: ansi
|