shindo 0.0.17 → 0.0.18

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/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ gem 'rake'
2
+ gem 'formatador', '>=0.0.14'
3
+ gem 'gestalt', '>=0.0.6'
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ ---
2
+ specs:
3
+ - rake:
4
+ version: 0.8.7
5
+ - formatador:
6
+ version: 0.0.14
7
+ - gestalt:
8
+ version: 0.0.6
9
+ hash: 967644697cb16cde400ae3abbd4c764876c4a3b0
10
+ sources: []
11
+
12
+ dependencies:
13
+ formatador:
14
+ version: ">= 0.0.14"
15
+ group:
16
+ - :default
17
+ rake:
18
+ version: ">= 0"
19
+ group:
20
+ - :default
21
+ gestalt:
22
+ version: ">= 0.0.6"
23
+ group:
24
+ - :default
data/README.rdoc CHANGED
@@ -66,7 +66,7 @@ Run tests with the shindo command, the easiest is to specify a file name:
66
66
 
67
67
  shindo something_tests.rb
68
68
 
69
- You can also give directories and it will run all files ending in _tests.rb (recurses through subdirectories)
69
+ You can also give directories and it will run all files ending in _tests.rb and include all files ending in _helper.rb (recurses through subdirectories)
70
70
 
71
71
  shindo some_test_directory
72
72
 
data/Rakefile CHANGED
@@ -1,41 +1,142 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'date'
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "shindo"
8
- gem.summary = %Q{ruby testing}
9
- gem.description = %Q{Simple depth first ruby testing}
10
- gem.email = "me@geemus.com"
11
- gem.homepage = "http://github.com/geemus/shindo"
12
- gem.authors = ["geemus (Wesley Beary)"]
13
- gem.rubyforge_project = "shindo"
14
- gem.add_dependency('annals', '>=0.0.2')
15
- gem.add_dependency('formatador', '>=0.0.2')
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- end
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
20
13
  end
21
14
 
22
- require File.join(File.dirname(__FILE__), 'lib', 'shindo', 'rake')
23
- Shindo::Rake.new
15
+ def version
16
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ end
24
19
 
25
- task :tests => :check_dependencies
20
+ def date
21
+ Date.today.to_s
22
+ end
26
23
 
24
+ def rubyforge_project
25
+ name
26
+ end
27
+
28
+ def gemspec_file
29
+ "#{name}.gemspec"
30
+ end
31
+
32
+ def gem_file
33
+ "#{name}-#{version}.gem"
34
+ end
35
+
36
+ def replace_header(head, header_name)
37
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
38
+ end
39
+
40
+ #############################################################################
41
+ #
42
+ # Standard tasks
43
+ #
44
+ #############################################################################
45
+
46
+ require File.join(File.dirname(__FILE__), 'lib', 'shindo', 'rake')
47
+ Shindo::Rake.new
27
48
  task :default => :tests
28
49
 
50
+ desc "Generate RCov test coverage and open in your browser"
51
+ task :coverage do
52
+ require 'rcov'
53
+ sh "rm -fr coverage"
54
+ sh "rcov test/test_*.rb"
55
+ sh "open coverage/index.html"
56
+ end
57
+
29
58
  require 'rake/rdoctask'
30
59
  Rake::RDocTask.new do |rdoc|
31
- if File.exist?('VERSION')
32
- version = File.read('VERSION')
33
- else
34
- version = ""
35
- end
36
-
37
60
  rdoc.rdoc_dir = 'rdoc'
38
- rdoc.title = "shindo #{version}"
61
+ rdoc.title = "#{name} #{version}"
39
62
  rdoc.rdoc_files.include('README*')
40
63
  rdoc.rdoc_files.include('lib/**/*.rb')
41
64
  end
65
+
66
+ desc "Open an irb session preloaded with this library"
67
+ task :console do
68
+ sh "irb -rubygems -r ./lib/#{name}.rb"
69
+ end
70
+
71
+ #############################################################################
72
+ #
73
+ # Custom tasks (add your own tasks here)
74
+ #
75
+ #############################################################################
76
+
77
+
78
+
79
+ #############################################################################
80
+ #
81
+ # Packaging tasks
82
+ #
83
+ #############################################################################
84
+
85
+ task :release => :build do
86
+ unless `git branch` =~ /^\* master$/
87
+ puts "You must be on the master branch to release!"
88
+ exit!
89
+ end
90
+ sh "sudo gem install pkg/#{name}-#{version}.gem"
91
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
92
+ sh "git tag v#{version}"
93
+ sh "git push origin master"
94
+ sh "git push origin v#{version}"
95
+ sh "gem push pkg/#{name}-#{version}.gem"
96
+ end
97
+
98
+ task :build => :gemspec do
99
+ sh "mkdir -p pkg"
100
+ sh "gem build #{gemspec_file}"
101
+ sh "mv #{gem_file} pkg"
102
+ end
103
+
104
+ task :gemspec => :validate do
105
+ # read spec file and split out manifest section
106
+ spec = File.read(gemspec_file)
107
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
108
+
109
+ # replace name version and date
110
+ replace_header(head, :name)
111
+ replace_header(head, :version)
112
+ replace_header(head, :date)
113
+ #comment this out if your rubyforge_project has a different name
114
+ replace_header(head, :rubyforge_project)
115
+
116
+ # determine file list from git ls-files
117
+ files = `git ls-files`.
118
+ split("\n").
119
+ sort.
120
+ reject { |file| file =~ /^\./ }.
121
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
122
+ map { |file| " #{file}" }.
123
+ join("\n")
124
+
125
+ # piece file back together and write
126
+ manifest = " s.files = %w[\n#{files}\n ]\n"
127
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
128
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
129
+ puts "Updated #{gemspec_file}"
130
+ end
131
+
132
+ task :validate do
133
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
134
+ unless libfiles.empty?
135
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
136
+ exit!
137
+ end
138
+ unless Dir['VERSION*'].empty?
139
+ puts "A `VERSION` file at root level violates Gem best practices."
140
+ exit!
141
+ end
142
+ end
data/lib/shindo.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  require 'rubygems'
2
- require 'annals'
3
2
  require 'formatador'
4
3
 
5
4
  module Shindo
6
5
 
6
+ unless VERSION
7
+ VERSION = '0.0.18'
8
+ end
9
+
7
10
  def self.tests(description = nil, tags = [], &block)
8
11
  STDOUT.sync = true
9
12
  Shindo::Tests.new(description, tags, &block)
@@ -11,118 +14,93 @@ module Shindo
11
14
 
12
15
  class Tests
13
16
 
14
- attr_accessor :backtrace
15
-
16
17
  def initialize(description, tags = [], &block)
17
18
  @afters = []
18
- @annals = Annals.new
19
19
  @befores = []
20
20
  @formatador = Formatador.new
21
- @success = true
22
21
  @tag_stack = []
23
- Thread.current[:reload] = false;
22
+ Thread.current[:reload] = false
23
+ Thread.current[:success] = true
24
24
  Thread.current[:tags] ||= []
25
- @if_tagged = Thread.current[:tags].
26
- select {|tag| tag.match(/^\+/)}.
27
- map {|tag| tag[1..-1]}
28
- @unless_tagged = Thread.current[:tags].
29
- select {|tag| tag.match(/^\-/)}.
30
- map {|tag| tag[1..-1]}
31
- @formatador.display_line('')
25
+ @if_tagged = []
26
+ @unless_tagged = []
27
+ for tag in Thread.current[:tags]
28
+ case tag[0...1]
29
+ when '+'
30
+ @if_tagged << tag[1..-1]
31
+ when '-'
32
+ @unless_tagged << tag[1..-1]
33
+ end
34
+ end
35
+ @formatador.display_line
32
36
  tests(description, tags, &block)
33
- @formatador.display_line('')
34
- Thread.current[:success] = @success
37
+ @formatador.display_line
35
38
  end
36
39
 
37
40
  def after(&block)
38
- @afters[-1].push(block)
41
+ @afters.last.push(block)
39
42
  end
40
43
 
41
44
  def before(&block)
42
- @befores[-1].push(block)
45
+ @befores.last.push(block)
43
46
  end
44
47
 
45
48
  def prompt(description, &block)
46
- @formatador.display("Action? [c,i,q,r,t,#,?]? ")
49
+ @formatador.display("Action? [c,e,i,q,r,t,?]? ")
47
50
  choice = STDIN.gets.strip
48
- @formatador.display_line("")
49
- case choice
50
- when 'c'
51
- return
52
- when 'i'
53
- @formatador.display_line('Starting interactive session...')
54
- if @irb.nil?
55
- require 'irb'
56
- ARGV.clear # Avoid passing args to IRB
57
- IRB.setup(nil)
58
- @irb = IRB::Irb.new(nil)
59
- IRB.conf[:MAIN_CONTEXT] = @irb.context
60
- IRB.conf[:PROMPT][:SHINDO] = {}
61
- end
62
- for key, value in IRB.conf[:PROMPT][:SIMPLE]
63
- IRB.conf[:PROMPT][:SHINDO][key] = "#{@formatador.indentation}#{value}"
64
- end
65
- @irb.context.prompt_mode = :SHINDO
66
- @irb.context.workspace = IRB::WorkSpace.new(block.binding)
67
- begin
68
- @irb.eval_input
69
- rescue SystemExit
70
- end
71
- when 'q'
72
- Thread.current[:success] = false
73
- Thread.exit
74
- when 'r'
75
- @formatador.display_line("Reloading...")
76
- Thread.current[:reload] = true
77
- Thread.exit
78
- when 't'
79
- @formatador.indent do
80
- if @annals.lines.empty?
81
- @formatador.display_line('no backtrace available')
82
- else
83
- @annals.lines.each_with_index do |line, index|
84
- @formatador.display_line("#{' ' * (2 - index.to_s.length)}#{index} #{line}")
85
- end
51
+ @formatador.display_line
52
+ @formatador.indent do
53
+ case choice
54
+ when 'c', 'continue'
55
+ return
56
+ when /^e .*/, /^eval .*/
57
+ value = eval(choice[2..-1], block.binding)
58
+ if value.nil?
59
+ value = 'nil'
86
60
  end
87
- end
88
- @formatador.display_line('')
89
- when '?'
90
- @formatador.display_line('c - ignore this error and continue')
91
- @formatador.display_line('i - interactive mode')
92
- @formatador.display_line('q - quit Shindo')
93
- @formatador.display_line('r - reload and run the tests again')
94
- @formatador.display_line('t - display backtrace')
95
- @formatador.display_line('# - enter a number of a backtrace line to see its context')
96
- @formatador.display_line('? - display help')
97
- when /\d/
98
- index = choice.to_i - 1
99
- if @annals.lines[index]
100
- @formatador.indent do
101
- @formatador.display_line("#{@annals.lines[index]}: ")
102
- @formatador.indent do
103
- @formatador.display("\n")
104
- current_line = @annals.buffer[index]
105
- File.open(current_line[:file], 'r') do |file|
106
- data = file.readlines
107
- current = current_line[:line]
108
- min = [0, current - (@annals.max / 2)].max
109
- max = [current + (@annals.max / 2), data.length].min
110
- min.upto(current - 1) do |line|
111
- @formatador.display_line("#{line} #{data[line].rstrip}")
112
- end
113
- @formatador.display_line("[yellow]#{current} #{data[current].rstrip}[/]")
114
- (current + 1).upto(max - 1) do |line|
115
- @formatador.display_line("#{line} #{data[line].rstrip}")
116
- end
117
- end
118
- @formatador.display_line('')
119
- end
61
+ @formatador.display_line(value)
62
+ when 'i', 'interactive', 'irb'
63
+ @formatador.display_line('Starting interactive session...')
64
+ if @irb.nil?
65
+ require 'irb'
66
+ ARGV.clear # Avoid passing args to IRB
67
+ IRB.setup(nil)
68
+ @irb = IRB::Irb.new(nil)
69
+ IRB.conf[:MAIN_CONTEXT] = @irb.context
70
+ IRB.conf[:PROMPT][:SHINDO] = {}
120
71
  end
72
+ for key, value in IRB.conf[:PROMPT][:SIMPLE]
73
+ IRB.conf[:PROMPT][:SHINDO][key] = "#{@formatador.indentation}#{value}"
74
+ end
75
+ @irb.context.prompt_mode = :SHINDO
76
+ @irb.context.workspace = IRB::WorkSpace.new(block.binding)
77
+ begin
78
+ @irb.eval_input
79
+ rescue SystemExit
80
+ end
81
+ when 'q', 'quit', 'exit'
82
+ Thread.current[:success] = false
83
+ Thread.exit
84
+ when 'r', 'reload'
85
+ @formatador.display_line("Reloading...")
86
+ Thread.current[:reload] = true
87
+ Thread.exit
88
+ when 't', 'backtrace', 'trace'
89
+ require 'gestalt'
90
+ Gestalt.trace({'c-call' => true, 'formatador' => @formatador}, &block)
91
+ when '?', 'help'
92
+ @formatador.display_lines([
93
+ 'c - ignore this error and continue',
94
+ 'i - interactive mode',
95
+ 'q - quit Shindo',
96
+ 'r - reload and run the tests again',
97
+ 't - display backtrace',
98
+ '? - display help'
99
+ ])
121
100
  else
122
- @formatador.display_line("[red]#{choice} is not a valid backtrace line, please try again.[/]")
101
+ @formatador.display_line("[red]#{choice} is not a valid choice, please try again.[/]")
123
102
  end
124
- else
125
- @formatador.display_line("[red]#{choice} is not a valid choice, please try again.[/]")
103
+ @formatador.display_line
126
104
  end
127
105
  @formatador.display_line("[red]- #{description}[/]")
128
106
  prompt(description, &block)
@@ -134,12 +112,11 @@ module Shindo
134
112
  @befores.push([])
135
113
  @afters.push([])
136
114
 
137
- taggings = ''
138
115
  unless tags.empty?
139
116
  taggings = " (#{tags.join(', ')})"
140
117
  end
141
118
 
142
- @formatador.display_line((description || 'Shindo.tests') << taggings)
119
+ @formatador.display_line((description || 'Shindo.tests') << taggings.to_s)
143
120
  if block_given?
144
121
  @formatador.indent { instance_eval(&block) }
145
122
  end
@@ -152,7 +129,6 @@ module Shindo
152
129
  def test(description, tags = [], &block)
153
130
  tags = [*tags]
154
131
  @tag_stack.push(tags)
155
- taggings = ''
156
132
  unless tags.empty?
157
133
  taggings = " (#{tags.join(', ')})"
158
134
  end
@@ -165,41 +141,27 @@ module Shindo
165
141
  for before in @befores.flatten.compact
166
142
  before.call
167
143
  end
168
-
169
- @annals.start
170
- success = instance_eval(&block)
171
- @annals.stop
172
-
144
+ Thread.current[:success] = instance_eval(&block)
173
145
  for after in @afters.flatten.compact
174
146
  after.call
175
147
  end
176
148
  rescue => error
177
- @annals.stop
178
- success = false
179
- file, line, method = error.backtrace.first.split(':')
180
- if method
181
- method << "in #{method[4...-1]} " # get method from "in `foo'"
182
- else
183
- method = ''
184
- end
185
- method << "! #{error.message} (#{error.class})"
186
- @annals.unshift(:file => file, :line => line.to_i, :method => method)
149
+ Thread.current[:success] = false
187
150
  @formatador.display_line("[red]#{error.message} (#{error.class})[/]")
188
151
  end
189
- @success = @success && success
190
- if success
191
- @formatador.display_line("[green]+ #{description}#{taggings}[/]")
152
+ if Thread.current[:success]
153
+ @formatador.display_line("[green]+ #{description}#{taggings.to_s}[/]")
192
154
  else
193
- @formatador.display_line("[red]- #{description}#{taggings}[/]")
155
+ @formatador.display_line("[red]- #{description}#{taggings.to_s}[/]")
194
156
  if STDOUT.tty?
195
157
  prompt(description, &block)
196
158
  end
197
159
  end
198
160
  else
199
- @formatador.display_line("[yellow]* #{description}#{taggings}[/]")
161
+ @formatador.display_line("[yellow]* #{description}#{taggings.to_s}[/]")
200
162
  end
201
163
  else
202
- @formatador.display_line("_ #{description}#{taggings}")
164
+ @formatador.display_line("_ #{description}#{taggings.to_s}")
203
165
  end
204
166
 
205
167
  @tag_stack.pop
@@ -208,3 +170,27 @@ module Shindo
208
170
  end
209
171
 
210
172
  end
173
+
174
+
175
+ if __FILE__ == $0
176
+
177
+ def bar(string, remaining = ['b','a','r'])
178
+ if remaining.empty?
179
+ string
180
+ else
181
+ bar(string << remaining.shift, remaining)
182
+ end
183
+ end
184
+
185
+ Shindo.tests do
186
+
187
+ test('failure') do
188
+ raise StandardError.new('exception')
189
+ @foo = ''
190
+ bar(@foo)
191
+ @foo == 'foo'
192
+ end
193
+
194
+ end
195
+
196
+ end
data/lib/shindo/rake.rb CHANGED
@@ -3,9 +3,9 @@ module Shindo
3
3
  class Rake
4
4
 
5
5
  def initialize
6
- desc "Run tests"
6
+ desc "Run shindo tests"
7
7
  task :tests do
8
- system "shindo #{FileList[ 'tests/**/*_tests.rb' ].join(' ')}"
8
+ system 'shindo'
9
9
  end
10
10
  end
11
11
 
data/shindo.gemspec CHANGED
@@ -1,57 +1,86 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
1
+ ## This is the rakegem gemspec template. Make sure you read and understand
2
+ ## all of the comments. Some sections require modification, and others can
3
+ ## be deleted if you don't need them. Once you understand the contents of
4
+ ## this file, feel free to delete any comments that begin with two hash marks.
5
+ ## You can find comprehensive Gem::Specification documentation, at
6
+ ## http://docs.rubygems.org/read/chapter/20
6
7
  Gem::Specification.new do |s|
7
- s.name = %q{shindo}
8
- s.version = "0.0.17"
9
-
8
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["geemus (Wesley Beary)"]
12
- s.date = %q{2010-03-28}
13
- s.default_executable = %q{shindo}
14
- s.description = %q{Simple depth first ruby testing}
15
- s.email = %q{me@geemus.com}
10
+ s.rubygems_version = '1.3.5'
11
+
12
+ ## Leave these as is they will be modified for you by the rake gemspec task.
13
+ ## If your rubyforge_project name is different, then edit it and comment out
14
+ ## the sub! line in the Rakefile
15
+ s.name = 'shindo'
16
+ s.version = '0.0.18'
17
+ s.date = '2010-05-02'
18
+ s.rubyforge_project = 'shindo'
19
+
20
+ ## Make sure your summary is short. The description may be as long
21
+ ## as you like.
22
+ s.summary = "Ruby testing."
23
+ s.description = "Simple depth first ruby testing."
24
+
25
+ ## List the primary authors. If there are a bunch of authors, it's probably
26
+ ## better to set the email to an email list or something. If you don't have
27
+ ## a custom homepage, consider using your GitHub URL or the like.
28
+ s.authors = ["geemus (Wesley Beary)"]
29
+ s.email = 'geemus@gmail.com'
30
+ s.homepage = 'http://github.com/geemus/NAME'
31
+
32
+ ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
33
+ ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
34
+ s.require_paths = %w[lib]
35
+
36
+ ## This sections is only necessary if you have C extensions.
37
+ # s.require_paths << 'ext'
38
+ # s.extensions = %w[ext/extconf.rb]
39
+
40
+ ## If your gem includes any executables, list them here.
16
41
  s.executables = ["shindo"]
17
- s.extra_rdoc_files = [
18
- "README.rdoc"
19
- ]
20
- s.files = [
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"
33
- ]
34
- s.homepage = %q{http://github.com/geemus/shindo}
42
+ s.default_executable = 'shindo'
43
+
44
+ ## Specify any RDoc options here. You'll want to add your README and
45
+ ## LICENSE files to the extra_rdoc_files list.
35
46
  s.rdoc_options = ["--charset=UTF-8"]
36
- s.require_paths = ["lib"]
37
- s.rubyforge_project = %q{shindo}
38
- s.rubygems_version = %q{1.3.6}
39
- s.summary = %q{ruby testing}
40
-
41
- if s.respond_to? :specification_version then
42
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
- s.specification_version = 3
44
-
45
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
- s.add_runtime_dependency(%q<annals>, [">= 0.0.2"])
47
- s.add_runtime_dependency(%q<formatador>, [">= 0.0.2"])
48
- else
49
- s.add_dependency(%q<annals>, [">= 0.0.2"])
50
- s.add_dependency(%q<formatador>, [">= 0.0.2"])
51
- end
52
- else
53
- s.add_dependency(%q<annals>, [">= 0.0.2"])
54
- s.add_dependency(%q<formatador>, [">= 0.0.2"])
55
- end
56
- end
47
+ s.extra_rdoc_files = %w[README.rdoc]
48
+
49
+ ## List your runtime dependencies here. Runtime dependencies are those
50
+ ## that are needed for an end user to actually USE your code.
51
+ s.add_dependency('formatador', '>=0.0.14')
52
+ s.add_dependency('gestalt', '>=0.0.6')
57
53
 
54
+ ## List your development dependencies here. Development dependencies are
55
+ ## those that are only needed during development
56
+ # s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
57
+
58
+ ## Leave this section as-is. It will be automatically generated from the
59
+ ## contents of your Git repository via the gemspec task. DO NOT REMOVE
60
+ ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
61
+ # = MANIFEST =
62
+ s.files = %w[
63
+ Gemfile
64
+ Gemfile.lock
65
+ README.rdoc
66
+ Rakefile
67
+ bin/shindo
68
+ lib/shindo.rb
69
+ lib/shindo/rake.rb
70
+ shindo.gemspec
71
+ tests/basic_tests.rb
72
+ tests/data/exception
73
+ tests/data/failure
74
+ tests/data/negative
75
+ tests/data/pending
76
+ tests/data/positive
77
+ tests/data/success
78
+ tests/tag_tests.rb
79
+ tests/tests_helper.rb
80
+ ]
81
+ # = MANIFEST =
82
+
83
+ ## Test files will be grabbed from the file list. Make sure the path glob
84
+ ## matches what you actually use.
85
+ s.test_files = s.files.select { |path| path =~ /^[spec|tests]\/.*_[spec|tests]\.rb/ }
86
+ end
data/tests/basic_tests.rb CHANGED
@@ -1,50 +1,27 @@
1
1
  Shindo.tests('basics') do
2
+
2
3
  tests('exception') do
3
- before do
4
- @tempfile = tempfile('exception', <<-TESTS)
5
- Shindo.tests do
6
- test('exception') { raise StandardError.new('exception') }
7
- end
8
- TESTS
9
- @output = bin(@tempfile.path)
10
- end
4
+ @output = bin(path('exception'))
11
5
  test('output') { @output.include?('- exception') }
12
6
  test('status') { $?.exitstatus == 1 }
13
7
  end
8
+
14
9
  tests('failure') do
15
- before do
16
- @tempfile = tempfile('failure', <<-TESTS)
17
- Shindo.tests do
18
- test('failure') { false }
19
- end
20
- TESTS
21
- @output = bin(@tempfile.path)
22
- end
10
+ @output = bin(path('failure'))
23
11
  test('output') { @output.include?('- failure') }
24
12
  test('status') { $?.exitstatus == 1 }
25
13
  end
14
+
26
15
  tests('pending') do
27
- before do
28
- @tempfile = tempfile('pending', <<-TESTS)
29
- Shindo.tests do
30
- test('pending')
31
- end
32
- TESTS
33
- @output = bin(@tempfile.path)
34
- end
16
+ @output = bin(path('pending'))
35
17
  test('output') { @output.include?('* pending') }
36
18
  test('status') { $?.exitstatus == 0 }
37
19
  end
20
+
38
21
  tests('success') do
39
- before do
40
- @tempfile = tempfile('success', <<-TESTS)
41
- Shindo.tests do
42
- test('success') { true }
43
- end
44
- TESTS
45
- @output = bin(@tempfile.path)
46
- end
22
+ @output = bin(path('success'))
47
23
  test('output') { @output.include?('+ success') }
48
24
  test('status') { $?.exitstatus == 0 }
49
25
  end
26
+
50
27
  end
@@ -0,0 +1,3 @@
1
+ Shindo.tests do
2
+ test('exception') { raise StandardError.new('exception') }
3
+ end
@@ -0,0 +1,3 @@
1
+ Shindo.tests do
2
+ test('failure') { false }
3
+ end
@@ -0,0 +1,4 @@
1
+ Shindo.tests do
2
+ test('is tested') { true }
3
+ test('is skipped', 'negative') { false }
4
+ end
@@ -0,0 +1,3 @@
1
+ Shindo.tests do
2
+ test('pending')
3
+ end
@@ -0,0 +1,4 @@
1
+ Shindo.tests do
2
+ test('is tested', 'positive') { true }
3
+ test('is skipped') { false }
4
+ end
@@ -0,0 +1,3 @@
1
+ Shindo.tests do
2
+ test('success') { true }
3
+ end
data/tests/tag_tests.rb CHANGED
@@ -1,30 +1,14 @@
1
1
  Shindo.tests('tags') do
2
2
 
3
3
  tests('negative') do
4
- before do
5
- @tempfile = tempfile('negative', <<-TESTS)
6
- Shindo.tests do
7
- test('is tested') { true }
8
- test('is skipped', 'negative') { false }
9
- end
10
- TESTS
11
- @output = bin("#{@tempfile.path} -negative")
12
- end
4
+ @output = bin("#{path('negative')} -negative")
13
5
  test('is tested') { @output.include?('+ is tested') }
14
6
  test('is skipped') { @output.include?('_ is skipped (negative)') }
15
7
  test('status') { $?.exitstatus == 0 }
16
8
  end
17
9
 
18
10
  tests('positive') do
19
- before do
20
- @tempfile = tempfile('positive', <<-TESTS)
21
- Shindo.tests do
22
- test('is tested', 'positive') { true }
23
- test('is skipped') { false }
24
- end
25
- TESTS
26
- @output = bin("#{@tempfile.path} +positive")
27
- end
11
+ @output = bin("#{path('positive')} +positive")
28
12
  test('is tested') { @output.include?('+ is tested (positive)') }
29
13
  test('is skipped') { @output.include?('_ is skipped') }
30
14
  test('status') { $?.exitstatus == 0 }
@@ -1,16 +1,11 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'shindo'))
2
2
 
3
- require 'tempfile'
4
-
5
3
  BIN = File.join(File.dirname(__FILE__), '..', 'bin', 'shindo')
6
4
 
7
5
  def bin(arguments)
8
6
  `#{BIN} #{arguments}`
9
7
  end
10
8
 
11
- def tempfile(name, data)
12
- tempfile = Tempfile.new(name)
13
- tempfile << data
14
- tempfile.close
15
- tempfile
9
+ def path(name)
10
+ File.join(File.dirname(__FILE__), 'data', name)
16
11
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 17
9
- version: 0.0.17
8
+ - 18
9
+ version: 0.0.18
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,11 +14,11 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-28 00:00:00 -07:00
17
+ date: 2010-05-02 00:00:00 -07:00
18
18
  default_executable: shindo
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: annals
21
+ name: formatador
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  requirements:
@@ -27,12 +27,12 @@ dependencies:
27
27
  segments:
28
28
  - 0
29
29
  - 0
30
- - 2
31
- version: 0.0.2
30
+ - 14
31
+ version: 0.0.14
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
- name: formatador
35
+ name: gestalt
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  requirements:
@@ -41,12 +41,12 @@ dependencies:
41
41
  segments:
42
42
  - 0
43
43
  - 0
44
- - 2
45
- version: 0.0.2
44
+ - 6
45
+ version: 0.0.6
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
- description: Simple depth first ruby testing
49
- email: me@geemus.com
48
+ description: Simple depth first ruby testing.
49
+ email: geemus@gmail.com
50
50
  executables:
51
51
  - shindo
52
52
  extensions: []
@@ -54,20 +54,25 @@ extensions: []
54
54
  extra_rdoc_files:
55
55
  - README.rdoc
56
56
  files:
57
- - .document
58
- - .gitignore
57
+ - Gemfile
58
+ - Gemfile.lock
59
59
  - README.rdoc
60
60
  - Rakefile
61
- - VERSION
62
61
  - bin/shindo
63
62
  - lib/shindo.rb
64
63
  - lib/shindo/rake.rb
65
64
  - shindo.gemspec
66
65
  - tests/basic_tests.rb
66
+ - tests/data/exception
67
+ - tests/data/failure
68
+ - tests/data/negative
69
+ - tests/data/pending
70
+ - tests/data/positive
71
+ - tests/data/success
67
72
  - tests/tag_tests.rb
68
73
  - tests/tests_helper.rb
69
74
  has_rdoc: true
70
- homepage: http://github.com/geemus/shindo
75
+ homepage: http://github.com/geemus/NAME
71
76
  licenses: []
72
77
 
73
78
  post_install_message:
@@ -94,7 +99,7 @@ requirements: []
94
99
  rubyforge_project: shindo
95
100
  rubygems_version: 1.3.6
96
101
  signing_key:
97
- specification_version: 3
98
- summary: ruby testing
102
+ specification_version: 2
103
+ summary: Ruby testing.
99
104
  test_files: []
100
105
 
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.17