Permalink
Browse files

simplify test running

do not require rubygems inside tests
shift test into load path
move test logic into helper so any new tests just require this helper
and can also be run independently
  • Loading branch information...
1 parent 32326cd commit fad6cf997704688d535a5b45e0c6a361a7c69cf1 Lee Jarvis committed Apr 29, 2011
Showing with 10 additions and 10 deletions.
  1. +1 −1 Rakefile
  2. +2 −9 test/test.rb
  3. +7 −0 test/test_helper.rb
View
@@ -31,7 +31,7 @@ def apply_spec_defaults(s)
end
task :test do
- sh "bacon #{direc}/test/test.rb"
+ sh "bacon -Itest -rubygems test/test.rb"
end
desc "run pry"
View
@@ -1,11 +1,4 @@
-direc = File.dirname(__FILE__)
-
-$LOAD_PATH.unshift "#{direc}/../lib"
-
-require 'rubygems'
-require 'bacon'
-require "pry"
-require "#{direc}/test_helper"
+require 'test_helper'
puts "Ruby Version #{RUBY_VERSION}"
puts "Testing Pry #{Pry::VERSION}"
@@ -135,7 +128,7 @@ class Hello
it "should run the rc file only once" do
Pry.should_load_rc = true
- Pry::RC_FILES << "#{direc}/testrc"
+ Pry::RC_FILES << File.expand_path("../testrc", __FILE__)
Pry.start(self, :input => StringIO.new("exit\n"), :output => Pry::NullOutput)
TEST_RC.should == [0]
View
@@ -1,3 +1,10 @@
+unless Object.const_defined? 'Pry'
+ $:.unshift File.expand_path '../../lib', __FILE__
+ require 'pry'
+end
+
+require 'bacon'
+
# Ensure we do not execute any rc files
Pry::RC_FILES.clear
Pry.color = false

0 comments on commit fad6cf9

Please sign in to comment.