assert 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
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/initializer.rb`. Use this file to specify user settings. User settings can be overridden by Local, CLI, and ENV settings.
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
- ### Showing Output
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 show it with the test result details:
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.show_output false
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|--show-output|--no-show-output]
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 'show_output', 'show stdout output (do not capture)', {
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 # TODO: secure random??
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
@@ -106,7 +106,7 @@ module Assert
106
106
  end
107
107
 
108
108
  def capture_output(&block)
109
- if Assert.config.show_output == false
109
+ if Assert.config.capture_output == true
110
110
  orig_stdout = $stdout.clone
111
111
  $stdout = capture_io
112
112
  block.call
@@ -1,3 +1,3 @@
1
1
  module Assert
2
- VERSION = "2.0.3"
2
+ VERSION = "2.1.0"
3
3
  end
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, :show_output, :halt_on_fail, :debug
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
- # TODO: secure random??
59
- @runner_seed = begin; srand; srand % 0xFFFF; end.to_i
60
- @show_output = true
61
- @halt_on_fail = true
62
- @debug = false
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 `show_output` setting in this setup block. Doing
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
@@ -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, :show_output, :halt_on_fail, :debug
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
@@ -161,11 +161,11 @@ class Assert::Test
161
161
  puts "std out from the test"
162
162
  assert true
163
163
  }
164
- @orig_show = Assert.config.show_output
165
- Assert.config.show_output false
164
+ @orig_capture = Assert.config.capture_output
165
+ Assert.config.capture_output true
166
166
  end
167
167
  teardown do
168
- Assert.config.show_output @orig_show
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: 9
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 3
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-03-31 00:00:00 Z
19
+ date: 2013-04-25 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: ansi