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
This commit is contained in:
Lee Jarvis 2011-04-29 15:55:35 +01:00
parent 32326cd05c
commit fad6cf9977
3 changed files with 10 additions and 10 deletions

View File

@ -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 File

@ -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 @@ describe Pry do
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 File

@ -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