shindo 0.3.4 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0e242a66a1e32f046b9679b17b4bfc81e6c96acca406c59a142a315192f18f91
4
+ data.tar.gz: 1b24e9ce0a145f077b3e30eb2bc2b6e6ea5f76a855adec26ebde472f9c139db3
5
+ SHA512:
6
+ metadata.gz: cfcc6bc96a24b0f0a986b53a587c27a1dbe391531206206ad29a908185e616f54f374b22970f1876becebc39a6365dba82c06e01bd380eac04a24959cc8f45dd
7
+ data.tar.gz: 8da45cf108ab6a42195f01d5d7b272c4bd9070bd177662ec8ef557c1f7bf24c68abde37fda0a3b14184a8249badc20f9ad3074403d0f196d94e43f5d6da67f20
@@ -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.
@@ -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>
@@ -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
@@ -55,7 +55,7 @@ task :coverage do
55
55
  sh "open coverage/index.html"
56
56
  end
57
57
 
58
- require 'rake/rdoctask'
58
+ require 'rdoc/task'
59
59
  Rake::RDocTask.new do |rdoc|
60
60
  rdoc.rdoc_dir = 'rdoc'
61
61
  rdoc.title = "#{name} #{version}"
@@ -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
- require File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'verbose')
4
- require File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin')
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'verbose'))
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
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  @thread_locals = { :interactive => false }
3
- require File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'taciturn')
4
- require File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'bin')
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo', 'taciturn'))
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
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'formatador'
3
2
 
4
3
  module Shindo
@@ -6,7 +5,7 @@ module Shindo
6
5
  class Pending < StandardError; end
7
6
 
8
7
  unless const_defined?(:VERSION)
9
- VERSION = '0.3.4'
8
+ VERSION = '0.3.9'
10
9
  end
11
10
 
12
11
  def self.tests(description = nil, tags = [], &block)
@@ -23,7 +22,7 @@ module Shindo
23
22
  @tag_stack = []
24
23
  Thread.current[:reload] = false
25
24
  Thread.current[:tags] ||= []
26
- 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 }
27
26
  @if_tagged = []
28
27
  @unless_tagged = []
29
28
  for tag in Thread.current[:tags]
@@ -34,6 +33,7 @@ module Shindo
34
33
  @unless_tagged << tag[1..-1]
35
34
  end
36
35
  end
36
+ @pending = nil
37
37
  Formatador.display_line
38
38
  tests(description, tags, &block)
39
39
  end
@@ -53,7 +53,7 @@ module Shindo
53
53
  def tests(description, tags = [], &block)
54
54
  return self if Thread.main[:exit] || Thread.current[:reload]
55
55
 
56
- tags = [*tags]
56
+ tags = [*tags].collect { |tag| tag.to_s }
57
57
  @tag_stack.push(tags)
58
58
  @befores.push([])
59
59
  @afters.push([])
@@ -131,7 +131,7 @@ module Shindo
131
131
  instance_eval(&block)
132
132
  rescue Shindo::Pending
133
133
  @pending = true
134
- rescue => error
134
+ rescue Exception => error
135
135
  error
136
136
  end
137
137
  [value, value.is_a?(expectation)]
@@ -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,10 +71,11 @@ 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
77
  status << "[red]#{@totals[:failed]} failed[/]," if @totals[:failed] > 0
78
+ status << "[red]#{@totals[:errored]} errored[/]," if @totals[:errored] > 0
78
79
  status << "[yellow]#{@totals[:pending]} pending[/]," if @totals[:pending] > 0
79
80
  status << "[green]#{@totals[:succeeded]} succeeded[/]"
80
81
  status = status[0...-2].join(', ') << ' and ' << status[-1] if status.length > 3
@@ -2,10 +2,13 @@ module Shindo
2
2
 
3
3
  class Rake
4
4
 
5
+ include ::Rake::DSL
6
+
5
7
  def initialize
6
8
  desc "Run shindo tests"
7
9
  task :tests do
8
10
  system 'shindo'
11
+ fail if $? != 0
9
12
  end
10
13
  end
11
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
@@ -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.4'
17
- s.date = '2011-03-21'
16
+ s.version = '0.3.9'
17
+ s.date = '2020-12-04'
18
18
  s.rubyforge_project = 'shindo'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -53,13 +53,24 @@ Gem::Specification.new do |s|
53
53
  ## List your development dependencies here. Development dependencies are
54
54
  ## those that are only needed during development
55
55
  # s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
56
+
57
+ if RUBY_VERSION.to_f <= 1.8
58
+ s.add_development_dependency('rake', '~> 10.5')
59
+ else
60
+ s.add_development_dependency('rake')
61
+ end
62
+
63
+ s.add_development_dependency('rdoc')
56
64
 
57
65
  ## Leave this section as-is. It will be automatically generated from the
58
66
  ## contents of your Git repository via the gemspec task. DO NOT REMOVE
59
67
  ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
60
68
  # = MANIFEST =
61
69
  s.files = %w[
70
+ CONTRIBUTING.md
71
+ CONTRIBUTORS.md
62
72
  Gemfile
73
+ LICENSE.md
63
74
  README.rdoc
64
75
  Rakefile
65
76
  bin/shindo
@@ -72,11 +83,14 @@ Gem::Specification.new do |s|
72
83
  shindo.gemspec
73
84
  tests/basic_tests.rb
74
85
  tests/bin_tests.rb
86
+ tests/data/contained-error
87
+ tests/data/error
75
88
  tests/data/exception
76
89
  tests/data/failure
77
90
  tests/data/negative
78
91
  tests/data/pending
79
92
  tests/data/positive
93
+ tests/data/sigint
80
94
  tests/data/success
81
95
  tests/tag_tests.rb
82
96
  tests/tests_helper.rb
@@ -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, 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, 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
@@ -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
@@ -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
- `#{BIN} #{arguments}`
7
+ `RUBYOPT="-rrubygems" #{BIN} #{arguments}`
7
8
  end
8
9
 
9
10
  def path(name)
metadata CHANGED
@@ -1,50 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: shindo
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 4
10
- version: 0.3.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.9
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - geemus (Wesley Beary)
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-03-21 00:00:00 -07:00
19
- default_executable: shindo
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: formatador
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
27
17
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 25
30
- segments:
31
- - 0
32
- - 1
33
- - 1
18
+ - !ruby/object:Gem::Version
34
19
  version: 0.1.1
35
20
  type: :runtime
36
- version_requirements: *id001
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
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'
37
55
  description: Work with your tests, not against them.
38
56
  email: geemus@gmail.com
39
- executables:
57
+ executables:
40
58
  - shindo
41
59
  - shindont
42
60
  extensions: []
43
-
44
- extra_rdoc_files:
61
+ extra_rdoc_files:
45
62
  - README.rdoc
46
- files:
63
+ files:
64
+ - CONTRIBUTING.md
65
+ - CONTRIBUTORS.md
47
66
  - Gemfile
67
+ - LICENSE.md
48
68
  - README.rdoc
49
69
  - Rakefile
50
70
  - bin/shindo
@@ -57,47 +77,38 @@ files:
57
77
  - shindo.gemspec
58
78
  - tests/basic_tests.rb
59
79
  - tests/bin_tests.rb
80
+ - tests/data/contained-error
81
+ - tests/data/error
60
82
  - tests/data/exception
61
83
  - tests/data/failure
62
84
  - tests/data/negative
63
85
  - tests/data/pending
64
86
  - tests/data/positive
87
+ - tests/data/sigint
65
88
  - tests/data/success
66
89
  - tests/tag_tests.rb
67
90
  - tests/tests_helper.rb
68
- has_rdoc: true
69
91
  homepage: http://github.com/geemus/shindo
70
92
  licenses: []
71
-
93
+ metadata: {}
72
94
  post_install_message:
73
- rdoc_options:
74
- - --charset=UTF-8
75
- require_paths:
95
+ rdoc_options:
96
+ - "--charset=UTF-8"
97
+ require_paths:
76
98
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
- requirements:
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
80
101
  - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 3
83
- segments:
84
- - 0
85
- version: "0"
86
- required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
89
106
  - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
95
109
  requirements: []
96
-
97
- rubyforge_project: shindo
98
- rubygems_version: 1.4.1
110
+ rubygems_version: 3.1.4
99
111
  signing_key:
100
112
  specification_version: 2
101
113
  summary: Simple depth first Ruby testing.
102
114
  test_files: []
103
-