From 50762b6f5aa3b466a93d5e6e336e067be3cb100b Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 16 Nov 2008 21:25:29 -0500 Subject: [PATCH] Cleaning up some requires to get rid of double-includes during spec runs --- Rakefile | 2 +- lib/webrat/rails.rb | 2 -- spec/spec_helper.rb | 7 ++++++- spec/webrat/merb/helper.rb | 2 +- spec/webrat/merb/session_spec.rb | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index 886c130..06662f4 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,7 @@ require "rake/clean" require 'spec' require 'spec/rake/spectask' require 'spec/rake/verify_rcov' -require './lib/webrat.rb' +require File.expand_path('./lib/webrat.rb') ############################################################################## # Package && release diff --git a/lib/webrat/rails.rb b/lib/webrat/rails.rb index 89fccd3..f95d75c 100644 --- a/lib/webrat/rails.rb +++ b/lib/webrat/rails.rb @@ -1,5 +1,3 @@ -require "webrat" - module Webrat class RailsSession < Session #:nodoc: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 88d8431..5af607e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,9 +4,14 @@ require "spec" # gem install redgreen for colored test output begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end -require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat") +webrat_path = File.expand_path(File.dirname(__FILE__) + "/../lib/") +$LOAD_PATH.unshift(webrat_path) unless $LOAD_PATH.include?(webrat_path) + +require "webrat" require File.expand_path(File.dirname(__FILE__) + "/fakes/test_session") +require "merb-core" + Spec::Runner.configure do |config| # Nothing to configure yet end diff --git a/spec/webrat/merb/helper.rb b/spec/webrat/merb/helper.rb index ca55fd2..4940bee 100644 --- a/spec/webrat/merb/helper.rb +++ b/spec/webrat/merb/helper.rb @@ -1,2 +1,2 @@ require 'merb-core' -require File.expand_path(File.dirname(__FILE__) + "/../../../lib/webrat/merb") \ No newline at end of file +require "webrat/merb" \ No newline at end of file diff --git a/spec/webrat/merb/session_spec.rb b/spec/webrat/merb/session_spec.rb index 641caa4..4553bc0 100644 --- a/spec/webrat/merb/session_spec.rb +++ b/spec/webrat/merb/session_spec.rb @@ -1,5 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper") -require File.expand_path(File.dirname(__FILE__) + "/helper") + +require "webrat/merb" describe Webrat::Session do