Permalink
Browse files

* bin/specrunner is a small bash kludge for running mini_rspec over

  a directory (recursively) or a single file
* Rakefile allows diffing a current spec run against a base run to
  easily see all changes among the thousands of specs as well as
  storing a base run
* specrunner produces decent output for the minimal spec output
  from mini_rspec
  • Loading branch information...
1 parent 299ee57 commit 086f889a9bae2e40dd6a8b1ffa80113070f3ad46 Eero Saynatkari committed May 2, 2007
Showing with 2,718 additions and 12 deletions.
  1. +32 −6 Rakefile
  2. +30 −0 bin/specrunner
  3. +2,644 −0 spec/diffs/base.txt
  4. +12 −6 spec/mini_rspec.rb
View
38 Rakefile
@@ -31,12 +31,14 @@ require_files(paths)
# By default, run all the specs and tests
task :default => :spec
-desc "Run all specs and tests."
-task :spec do
- Rake::Task['spec:all'].invoke rescue got_error = true
-
- raise "Spec or test failures." if got_error
-end
+desc 'Run all specs'
+task :spec => 'spec:new'
+#desc "Run all specs and tests."
+#task :spec do
+# Rake::Task['spec:all'].invoke rescue got_error = true
+#
+# raise "Spec or test failures." if got_error
+#end
namespace :spec do
desc "Run all specs and tests."
@@ -83,6 +85,30 @@ namespace :spec do
desc "Generate a coverage report for the core specs."
GroupCoverageReport.new(:core)
end
+
+ # New runner
+ desc 'Run all specs'
+ task :new do
+ system 'bin/specrunner spec'
+ end
+
+ # Specdiffs to make it easier to see what your changes have affected :)
+ desc 'Run specs and produce a diff against current base'
+ task :diff => 'diff:run'
+
+ namespace :diff do
+ desc 'Run specs and produce a diff against current base'
+ task :run do
+ system 'bin/specrunner spec > /tmp/rbs_specdiff'
+ system 'diff -u spec/diffs/base.txt /tmp/rbs_specdiff'
+ system 'rm /tmp/rbs_specdiff'
+ end
+
+ desc 'Replace the base spec file with a new one'
+ task :replace do
+ system 'bin/specrunner spec > spec/diffs/base.txt'
+ end
+ end
end
desc "Alias for test:all"
View
30 bin/specrunner
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+# Fear my elite bash skills
+
+TMPFILE="/tmp/mini_spec_specrunner.txt"
+
+# Files to run
+if [[ -d $1 ]]; then
+ SOURCE=`find $1 -name *_spec.rb`
+elif [[ -f $1 ]]; then
+ SOURCE=$1
+else
+ echo "Usage: [TARGET=<vm>] specrunner <file|directory>"
+ exit 1
+fi
+
+# Target VM
+if [[ $TARGET = "" ]]; then
+ TARGET=shotgun/rubinius
+fi
+
+for i in $SOURCE; do
+ $TARGET -rspec/mini_rspec.rb $i 2>> $TMPFILE
+done
+
+echo ""
+echo ""
+echo "Errors:"
+
+cat $TMPFILE
+rm $TMPFILE
View
2,644 spec/diffs/base.txt
2,644 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
18 spec/mini_rspec.rb
@@ -50,13 +50,13 @@ def setup
#def specify(msg)
# begin
# yield
-# STDERR.print '.'
+# STDOUT.print '.'
# rescue Exception => e
-# STDERR.print 'F'
-# STDOUT.print msg
-# STDOUT.print " FAILED\n"
-# STDOUT.print e.message
-# STDOUT.print "\n"
+# STDOUT.print 'F'
+# STDERR.print msg
+# STDERR.print " FAILED\n"
+# STDERR.print e.message
+# STDERR.print "\n\n"
# end
#end
#
@@ -94,3 +94,9 @@ def context(msg)
STDOUT.print "\n"
end
+
+
+# Alternatives
+alias describe context
+alias it specify
+

0 comments on commit 086f889

Please sign in to comment.