shindo 0.0.10 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.10
1
+ 0.0.13
data/bin/shindo CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.join(File.dirname(__FILE__), '..', 'lib', 'shindo')
3
3
 
4
- files = []
4
+ helpers = Dir.glob(File.join(Dir.pwd, '**', '*helper.rb'))
5
+ tests = []
5
6
  tags = []
6
7
  for argument in ARGV
7
8
  if argument.match(/^[\+\-]/)
@@ -9,33 +10,40 @@ for argument in ARGV
9
10
  else
10
11
  path = File.expand_path(argument)
11
12
  if File.directory?(path)
12
- files |= Dir.glob(File.join(path, '**', '*_tests.rb'))
13
+ tests |= Dir.glob(File.join(path, '**', '*tests.rb'))
13
14
  else
14
- files << path
15
+ tests << path
15
16
  end
16
17
  end
17
18
  end
18
19
 
20
+ if tests.empty?
21
+ tests << 'tests'
22
+ end
23
+
19
24
  @success = true
20
- def run_in_thread(files, tags)
21
- tests = Thread.new {
25
+ def run_in_thread(helpers, tests, tags)
26
+ shindo = Thread.new {
22
27
  Thread.current[:tags] = tags
23
- for file in files
28
+ for file in helpers
29
+ load(file)
30
+ end
31
+ for file in tests
24
32
  load(file)
25
33
  end
26
34
  }
27
- tests.join
28
- if tests[:reload]
35
+ shindo.join
36
+ if shindo[:reload]
29
37
  @success = true
30
- run_in_thread(files, tags)
38
+ run_in_thread(helpers, tests, tags)
31
39
  else
32
- @success = @success && tests[:success]
40
+ @success = @success && shindo[:success]
33
41
  end
34
42
  end
35
- run_in_thread(files, tags)
43
+ run_in_thread(helpers, tests, tags)
36
44
 
37
45
  if @success
38
46
  Kernel.exit(0)
39
47
  else
40
48
  Kernel.exit(1)
41
- end
49
+ end
data/lib/shindo.rb CHANGED
@@ -4,16 +4,16 @@ require 'formatador'
4
4
 
5
5
  module Shindo
6
6
 
7
- def self.tests(header = nil, &block)
7
+ def self.tests(description = nil, tags = [], &block)
8
8
  STDOUT.sync = true
9
- Shindo::Tests.new(header, &block)
9
+ Shindo::Tests.new(description, tags, &block)
10
10
  end
11
11
 
12
12
  class Tests
13
13
 
14
14
  attr_accessor :backtrace
15
15
 
16
- def initialize(header, tags = [], &block)
16
+ def initialize(description, tags = [], &block)
17
17
  @afters = []
18
18
  @annals = Annals.new
19
19
  @befores = []
@@ -29,7 +29,7 @@ module Shindo
29
29
  select {|tag| tag.match(/^\-/)}.
30
30
  map {|tag| tag[1..-1]}
31
31
  @formatador.display_line('')
32
- tests(header, tags, &block)
32
+ tests(description, tags, &block)
33
33
  @formatador.display_line('')
34
34
  Thread.current[:success] = @success
35
35
  end
@@ -129,13 +129,14 @@ module Shindo
129
129
  end
130
130
 
131
131
  def tests(description, tags = [], &block)
132
- @tag_stack.push([*tags])
132
+ tags = [*tags]
133
+ @tag_stack.push(tags)
133
134
  @befores.push([])
134
135
  @afters.push([])
135
136
 
136
137
  taggings = ''
137
138
  unless tags.empty?
138
- taggings = " (#{[*tags].join(', ')})"
139
+ taggings = " (#{tags.join(', ')})"
139
140
  end
140
141
 
141
142
  @formatador.display_line((description || 'Shindo.tests') << taggings)
@@ -149,10 +150,11 @@ module Shindo
149
150
  end
150
151
 
151
152
  def test(description, tags = [], &block)
152
- @tag_stack.push([*tags])
153
+ tags = [*tags]
154
+ @tag_stack.push(tags)
153
155
  taggings = ''
154
156
  unless tags.empty?
155
- taggings = " (#{[*tags].join(', ')})"
157
+ taggings = " (#{tags.join(', ')})"
156
158
  end
157
159
 
158
160
  # if the test includes +tags and discludes -tags, evaluate it
data/shindo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shindo}
8
- s.version = "0.0.10"
8
+ s.version = "0.0.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["geemus (Wesley Beary)"]
12
- s.date = %q{2009-12-24}
12
+ s.date = %q{2010-03-28}
13
13
  s.default_executable = %q{shindo}
14
14
  s.description = %q{Simple depth first ruby testing}
15
15
  s.email = %q{me@geemus.com}
@@ -19,23 +19,23 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
- ".gitignore",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "bin/shindo",
27
- "lib/shindo.rb",
28
- "lib/shindo/rake.rb",
29
- "shindo.gemspec",
30
- "tests/basic_tests.rb",
31
- "tests/tag_tests.rb",
32
- "tests/tests_helper.rb"
22
+ ".gitignore",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "bin/shindo",
27
+ "lib/shindo.rb",
28
+ "lib/shindo/rake.rb",
29
+ "shindo.gemspec",
30
+ "tests/basic_tests.rb",
31
+ "tests/tag_tests.rb",
32
+ "tests/tests_helper.rb"
33
33
  ]
34
34
  s.homepage = %q{http://github.com/geemus/shindo}
35
35
  s.rdoc_options = ["--charset=UTF-8"]
36
36
  s.require_paths = ["lib"]
37
37
  s.rubyforge_project = %q{shindo}
38
- s.rubygems_version = %q{1.3.5}
38
+ s.rubygems_version = %q{1.3.6}
39
39
  s.summary = %q{ruby testing}
40
40
 
41
41
  if s.respond_to? :specification_version then
data/tests/basic_tests.rb CHANGED
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'tests_helper')
2
-
3
1
  success = Tempfile.new('success')
4
2
  success << <<-TESTS
5
3
  Shindo.tests do
data/tests/tag_tests.rb CHANGED
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'tests_helper')
2
-
3
1
  negative = Tempfile.new('negative')
4
2
  negative << <<-TESTS
5
3
  Shindo.tests do
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shindo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 13
9
+ version: 0.0.13
5
10
  platform: ruby
6
11
  authors:
7
12
  - geemus (Wesley Beary)
@@ -9,29 +14,37 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-24 00:00:00 -08:00
17
+ date: 2010-03-28 00:00:00 -07:00
13
18
  default_executable: shindo
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: annals
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 0
30
+ - 2
23
31
  version: 0.0.2
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: formatador
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 0
44
+ - 2
33
45
  version: 0.0.2
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  description: Simple depth first ruby testing
36
49
  email: me@geemus.com
37
50
  executables:
@@ -66,18 +79,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
79
  requirements:
67
80
  - - ">="
68
81
  - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
69
84
  version: "0"
70
- version:
71
85
  required_rubygems_version: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
74
88
  - !ruby/object:Gem::Version
89
+ segments:
90
+ - 0
75
91
  version: "0"
76
- version:
77
92
  requirements: []
78
93
 
79
94
  rubyforge_project: shindo
80
- rubygems_version: 1.3.5
95
+ rubygems_version: 1.3.6
81
96
  signing_key:
82
97
  specification_version: 3
83
98
  summary: ruby testing