shindo 0.3.5 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 888bcf6781e3e4d16d3c58277eb19c992ee939a57e38aea00fe82cf0c7d0890c
4
+ data.tar.gz: cdfe64692891230c776c77b3bdf19ddd132c6186a55f082bfb2d504f620c2f90
5
+ SHA512:
6
+ metadata.gz: b97f6871025c5be6baab36c4f957839badf929a2665141abd637c356945fc0b5047520385b621e9be929866277e838dd65a0bc5ca3cca4c3d3035c877c1d054a
7
+ data.tar.gz: 38dd3fc1958d55ddceb266e0b991142f1e7dc20d05897318e97093614cf2b2bd854cd2f11bd6f50845484e98788c6f66f8321913aa2d21e3f2291199a8a9c1f6
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,18 @@
1
+ ## Getting Involved
2
+
3
+ New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
4
+
5
+ ### Coding
6
+
7
+ * Pick a task:
8
+ * Offer feedback on open [pull requests](https://github.com/geemus/shindo/pulls).
9
+ * Review open [issues](https://github.com/geemus/shindo/issues) for things to help on.
10
+ * [Create an issue](https://github.com/geemus/shindo/issues/new) to start a discussion on additions or features.
11
+ * Fork the project, add your changes and tests to cover them in a topic branch.
12
+ * Commit your changes and rebase against `geemus/shindo` to ensure everything is up to date.
13
+ * [Submit a pull request](https://github.com/geemus/shindo/compare/).
14
+
15
+ ### Non-Coding
16
+
17
+ * Offer feedback on open [issues](https://github.com/geemus/shindo/issues).
18
+ * Organize or volunteer at events.
data/CONTRIBUTORS.md ADDED
@@ -0,0 +1,14 @@
1
+ * Kenichi Kamiya <kachick1@gmail.com>
2
+ * Kevin Ball <kball@causes.com>
3
+ * Lee Jarvis <lee@jarvis.co>
4
+ * Lincoln Stoll <me@lstoll.net>
5
+ * Max Lincoln <max@devopsy.com>
6
+ * Sergio Rubio <rubiojr@frameos.org>
7
+ * Vít Ondruch <vondruch@redhat.com>
8
+ * Wesley Beary <geemus@engineyard.com>
9
+ * Wesley Beary <geemus@gmail.com>
10
+ * Wesley Beary <wbeary@engineyard.com>
11
+ * geemus (Wesley Beary) <geemus@gmail.com>
12
+ * geemus (Wesley Beary) <wbeary@engineyard.com>
13
+ * geemus <geemus@gmail.com>
14
+ * starbelly <starbelly@pobox.com>
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2009-2018 [CONTRIBUTORS.md](https://github.com/geemus/shindo/blob/master/CONTRIBUTORS.md)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ end
45
45
 
46
46
  require File.join(File.dirname(__FILE__), 'lib', 'shindo', 'rake')
47
47
  Shindo::Rake.new
48
- task :default => :tests
48
+ task :default => :shindo_tests
49
49
 
50
50
  desc "Generate RCov test coverage and open in your browser"
51
51
  task :coverage do
@@ -140,3 +140,12 @@ task :validate do
140
140
  exit!
141
141
  end
142
142
  end
143
+
144
+ task :shindo_tests do
145
+ system "shindo -build_error"
146
+ fail "Tests excluding build error should pass" unless $? == 0
147
+
148
+ puts "2"
149
+ system "shindo +build_error"
150
+ fail "The build_error test should fail" unless $? != 0
151
+ end
data/bin/shindo CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  @thread_locals = { :interactive => true }
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'verbose'))
4
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin'))
4
+ if Kernel.respond_to?(:require_relative)
5
+ require_relative File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin'))
6
+ else
7
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin'))
8
+ end
data/bin/shindont CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  @thread_locals = { :interactive => false }
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'taciturn'))
4
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin'))
4
+ if Kernel.respond_to?(:require_relative)
5
+ require_relative File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin'))
6
+ else
7
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin'))
8
+ end
data/lib/shindo.rb CHANGED
@@ -5,7 +5,7 @@ module Shindo
5
5
  class Pending < StandardError; end
6
6
 
7
7
  unless const_defined?(:VERSION)
8
- VERSION = '0.3.5'
8
+ VERSION = '0.3.10'
9
9
  end
10
10
 
11
11
  def self.tests(description = nil, tags = [], &block)
@@ -22,7 +22,7 @@ module Shindo
22
22
  @tag_stack = []
23
23
  Thread.current[:reload] = false
24
24
  Thread.current[:tags] ||= []
25
- Thread.current[:totals] ||= { :failed => 0, :pending => 0, :skipped => 0, :succeeded => 0 }
25
+ Thread.current[:totals] ||= { :failed => 0, :errored => 0, :pending => 0, :skipped => 0, :succeeded => 0 }
26
26
  @if_tagged = []
27
27
  @unless_tagged = []
28
28
  for tag in Thread.current[:tags]
@@ -33,6 +33,7 @@ module Shindo
33
33
  @unless_tagged << tag[1..-1]
34
34
  end
35
35
  end
36
+ @pending = nil
36
37
  Formatador.display_line
37
38
  tests(description, tags, &block)
38
39
  end
@@ -130,7 +131,7 @@ module Shindo
130
131
  instance_eval(&block)
131
132
  rescue Shindo::Pending
132
133
  @pending = true
133
- rescue => error
134
+ rescue Exception => error
134
135
  error
135
136
  end
136
137
  [value, value.is_a?(expectation)]
data/lib/shindo/bin.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '..', 'shindo')
2
2
 
3
- @interrupt = lambda do
3
+ @interrupt = proc do
4
4
  unless Thread.main[:exit]
5
5
  Formatador.display_line('Gracefully Exiting... (ctrl-c to force)')
6
6
  Thread.main[:exit] = true
@@ -20,7 +20,7 @@ if File.directory?('lib')
20
20
  end
21
21
 
22
22
  helpers = Dir.glob(File.join('tests', '**', '*helper.rb')).sort_by {|helper| helper.count(File::SEPARATOR)}
23
- tags = []
23
+ tags, tests = [], nil
24
24
  for argument in ARGV
25
25
  if argument.match(/^[\+\-]/)
26
26
  tags << argument
@@ -71,13 +71,14 @@ def run_in_thread(helpers, tests, thread_locals)
71
71
  end
72
72
  run_in_thread(helpers, tests, @thread_locals.merge({:tags => tags}))
73
73
 
74
- @totals ||= { :failed => 0, :pending => 0, :succeeded => 0 }
75
- @success = @totals[:failed] == 0
74
+ @totals ||= { :failed => 0, :errored => 0, :pending => 0, :succeeded => 0 }
75
+ @success = @totals[:failed] + @totals[:errored] == 0
76
76
  status = []
77
- status << "[red]#{@totals[:failed]} failed[/]," if @totals[:failed] > 0
78
- status << "[yellow]#{@totals[:pending]} pending[/]," if @totals[:pending] > 0
77
+ status << "[red]#{@totals[:failed]} failed[/]" if @totals[:failed] > 0
78
+ status << "[red]#{@totals[:errored]} errored[/]" if @totals[:errored] > 0
79
+ status << "[yellow]#{@totals[:pending]} pending[/]" if @totals[:pending] > 0
79
80
  status << "[green]#{@totals[:succeeded]} succeeded[/]"
80
- status = status[0...-2].join(', ') << ' and ' << status[-1] if status.length > 3
81
+ status = [status[0...-1].join(', '), 'and', status[-1]] if status.length >= 2
81
82
  status << "in [bold]#{Time.now - @started_at}[/] seconds"
82
83
  Formatador.display_lines(['', status.join(' '), ''])
83
84
 
data/lib/shindo/rake.rb CHANGED
@@ -8,6 +8,7 @@ module Shindo
8
8
  desc "Run shindo tests"
9
9
  task :tests do
10
10
  system 'shindo'
11
+ fail if $? != 0
11
12
  end
12
13
  end
13
14
 
@@ -20,6 +20,7 @@ module Shindo
20
20
  end
21
21
 
22
22
  def display_error(error)
23
+ Thread.current[:totals][:errored] += 1
23
24
  Formatador.display_lines(['', Thread.current[:file]])
24
25
  display_description_stack
25
26
  Formatador.display_line("[red]#{error.message} (#{error.class})[/]")
@@ -13,6 +13,7 @@ module Shindo
13
13
  end
14
14
 
15
15
  def display_error(error)
16
+ Thread.current[:totals][:errored] += 1
16
17
  Formatador.display_line("[red]#{error.message} (#{error.class})[/]")
17
18
  unless error.backtrace.empty?
18
19
  Formatador.indent do
data/shindo.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'shindo'
16
- s.version = '0.3.5'
17
- s.date = '2012-11-30'
16
+ s.version = '0.3.10'
17
+ s.date = '2021-03-01'
18
18
  s.rubyforge_project = 'shindo'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -54,12 +54,18 @@ Gem::Specification.new do |s|
54
54
  ## those that are only needed during development
55
55
  # s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
56
56
 
57
+ s.add_development_dependency('rake')
58
+ s.add_development_dependency('rdoc')
59
+
57
60
  ## Leave this section as-is. It will be automatically generated from the
58
61
  ## contents of your Git repository via the gemspec task. DO NOT REMOVE
59
62
  ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
60
63
  # = MANIFEST =
61
64
  s.files = %w[
65
+ CONTRIBUTING.md
66
+ CONTRIBUTORS.md
62
67
  Gemfile
68
+ LICENSE.md
63
69
  README.rdoc
64
70
  Rakefile
65
71
  bin/shindo
@@ -72,11 +78,14 @@ Gem::Specification.new do |s|
72
78
  shindo.gemspec
73
79
  tests/basic_tests.rb
74
80
  tests/bin_tests.rb
81
+ tests/data/contained-error
82
+ tests/data/error
75
83
  tests/data/exception
76
84
  tests/data/failure
77
85
  tests/data/negative
78
86
  tests/data/pending
79
87
  tests/data/positive
88
+ tests/data/sigint
80
89
  tests/data/success
81
90
  tests/tag_tests.rb
82
91
  tests/tests_helper.rb
data/tests/bin_tests.rb CHANGED
@@ -28,4 +28,19 @@ Shindo.tests('bin') do
28
28
  tests('$?.exitstatus').returns(0) { $?.exitstatus }
29
29
  end
30
30
 
31
- end
31
+ tests('error') do
32
+ @output = bin(path('error'))
33
+ includes('ok + returns true') { @output }
34
+ includes('1 errored and 1 succeeded') { @output }
35
+
36
+ tests('$?.exitstatus').returns(1) { $?.exitstatus }
37
+ end
38
+
39
+ tests('contained-error') do
40
+ @output = bin(path('contained-error'))
41
+ includes('ok + returns true') { @output }
42
+ includes('1 failed, 1 errored and 1 succeeded') { @output }
43
+
44
+ tests('$?.exitstatus').returns(1) { $?.exitstatus }
45
+ end
46
+ end
@@ -0,0 +1,24 @@
1
+ def given_something
2
+ raise 'ERROR!'
3
+ end
4
+
5
+ Shindo.tests('Shindo build errors', ['build_error']) do
6
+ tests('ok').returns(true) do
7
+ true
8
+ end
9
+
10
+ tests('contained') do
11
+ given_something do
12
+ tests('success').returns(true) do
13
+ false
14
+ end
15
+ tests('never_reached').return(true) do
16
+ true
17
+ end
18
+ end
19
+ end
20
+
21
+ tests('fail').returns(true) do
22
+ false
23
+ end
24
+ end
data/tests/data/error ADDED
@@ -0,0 +1,22 @@
1
+ def given_something
2
+ raise 'ERROR!'
3
+ end
4
+
5
+ Shindo.tests('Shindo build errors', ['build_error']) do
6
+ tests('ok').returns(true) do
7
+ true
8
+ end
9
+
10
+ given_something do
11
+ tests('success').returns(true) do
12
+ false
13
+ end
14
+ tests('never_reached').return(true) do
15
+ true
16
+ end
17
+ end
18
+
19
+ tests('fail').returns(true) do
20
+ false
21
+ end
22
+ end
data/tests/data/sigint ADDED
@@ -0,0 +1,4 @@
1
+ Shindo.tests do
2
+ test('success') { true }
3
+ sleep(20)
4
+ end
@@ -1,9 +1,10 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo'))
2
+ require 'open3'
2
3
 
3
4
  BIN = File.join(File.dirname(__FILE__), '..', 'bin', 'shindo')
4
5
 
5
6
  def bin(arguments)
6
- `RUBYOPT="-rubygems" #{BIN} #{arguments}`
7
+ `RUBYOPT="-rrubygems" #{BIN} #{arguments}`
7
8
  end
8
9
 
9
10
  def path(name)
metadata CHANGED
@@ -1,32 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shindo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
5
- prerelease:
4
+ version: 0.3.10
6
5
  platform: ruby
7
6
  authors:
8
7
  - geemus (Wesley Beary)
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-30 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: formatador
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.1.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.1.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
30
55
  description: Work with your tests, not against them.
31
56
  email: geemus@gmail.com
32
57
  executables:
@@ -36,7 +61,10 @@ extensions: []
36
61
  extra_rdoc_files:
37
62
  - README.rdoc
38
63
  files:
64
+ - CONTRIBUTING.md
65
+ - CONTRIBUTORS.md
39
66
  - Gemfile
67
+ - LICENSE.md
40
68
  - README.rdoc
41
69
  - Rakefile
42
70
  - bin/shindo
@@ -49,40 +77,38 @@ files:
49
77
  - shindo.gemspec
50
78
  - tests/basic_tests.rb
51
79
  - tests/bin_tests.rb
80
+ - tests/data/contained-error
81
+ - tests/data/error
52
82
  - tests/data/exception
53
83
  - tests/data/failure
54
84
  - tests/data/negative
55
85
  - tests/data/pending
56
86
  - tests/data/positive
87
+ - tests/data/sigint
57
88
  - tests/data/success
58
89
  - tests/tag_tests.rb
59
90
  - tests/tests_helper.rb
60
91
  homepage: http://github.com/geemus/shindo
61
92
  licenses: []
62
- post_install_message:
93
+ metadata: {}
94
+ post_install_message:
63
95
  rdoc_options:
64
- - --charset=UTF-8
96
+ - "--charset=UTF-8"
65
97
  require_paths:
66
98
  - lib
67
99
  required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
100
  requirements:
70
- - - ! '>='
101
+ - - ">="
71
102
  - !ruby/object:Gem::Version
72
103
  version: '0'
73
- segments:
74
- - 0
75
- hash: -213069165045248108
76
104
  required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
105
  requirements:
79
- - - ! '>='
106
+ - - ">="
80
107
  - !ruby/object:Gem::Version
81
108
  version: '0'
82
109
  requirements: []
83
- rubyforge_project: shindo
84
- rubygems_version: 1.8.23
85
- signing_key:
110
+ rubygems_version: 3.1.2
111
+ signing_key:
86
112
  specification_version: 2
87
113
  summary: Simple depth first Ruby testing.
88
114
  test_files: []