Cleaning up require structure

This commit is contained in:
Bryan Helmkamp 2008-10-25 12:59:21 -04:00
parent 324f412c7e
commit 2473cccb92
17 changed files with 44 additions and 29 deletions

View File

@ -1,5 +1,7 @@
require "rubygems"
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
module Webrat
VERSION = '0.2.2'
@ -8,10 +10,9 @@ module Webrat
end
end
require File.dirname(__FILE__) + "/webrat/core_extensions/blank"
require File.dirname(__FILE__) + "/webrat/core_extensions/hash_with_indifferent_access"
require File.dirname(__FILE__) + "/webrat/core_extensions/nil_to_param"
require File.dirname(__FILE__) + "/webrat/core"
# require "webrat/merb/param_parser"
# require "webrat/merb/url_encoded_pair_parser"
require "webrat/core"
require File.dirname(__FILE__) + "/webrat/rails" if defined?(RAILS_ENV)
require File.dirname(__FILE__) + "/webrat/merb" if defined?(Merb)
require "webrat/rails" if defined?(RAILS_ENV)
require "webrat/merb" if defined?(Merb)

View File

@ -1,3 +1,9 @@
Dir[File.join(File.dirname(__FILE__), "core", "*.rb")].sort.each do |file|
require File.expand_path(file)
end
require "webrat/core/logging"
require "webrat/core/flunk"
require "webrat/core/form"
require "webrat/core/scope"
require "webrat/core/link"
require "webrat/core/area"
require "webrat/core/label"
require "webrat/core/select_option"
require "webrat/core/session"

View File

@ -1,4 +1,7 @@
require "cgi"
require "webrat/core_extensions/blank"
require "webrat/core_extensions/nil_to_param"
require "webrat/merb/param_parser"
module Webrat
class Field

View File

@ -1,3 +1,6 @@
require "webrat/core/field"
require "webrat/core_extensions/blank"
module Webrat
class Form
attr_reader :element

View File

@ -1,3 +1,5 @@
require "webrat/core_extensions/blank"
module Webrat
class Link

View File

@ -1,4 +1,6 @@
require "hpricot"
require "webrat/core/form"
require "webrat/core/assertions"
module Webrat
class Scope

View File

@ -1,5 +1,3 @@
require "rubygems"
require "mechanize"
require File.dirname(__FILE__) + "/mechanize/mechanize_session"
require "webrat/mechanize/mechanize_session"

View File

@ -1,6 +1,4 @@
Dir[File.join(File.dirname(__FILE__), "merb", "*.rb")].sort.each do |file|
require File.expand_path(file)
end
require "webrat/core"
module Webrat
class Session
@ -33,6 +31,7 @@ module Webrat
end
protected
def do_request(url, data, headers, method)
@response = request(url, :params => (data && data.any?) ? data : nil, :headers => headers, :method => method)
self.get(@response.headers['Location'], nil, @response.headers) if @response.status == 302

View File

@ -1,4 +1,6 @@
require "cgi"
require "webrat/core_extensions/blank"
require "webrat/merb/url_encoded_pair_parser"
module Webrat
class ParamParser

View File

@ -1,5 +1,6 @@
require "cgi"
require "strscan"
require "webrat/core_extensions/hash_with_indifferent_access"
class UrlEncodedPairParser < StringScanner #:nodoc:
attr_reader :top, :parent, :result

View File

@ -1,3 +1,4 @@
require File.dirname(__FILE__) + "/rails/redirect_actions"
require File.dirname(__FILE__) + "/rails/rails_session"
require File.dirname(__FILE__) + "/rails/session"
require "webrat/core"
require "webrat/rails/redirect_actions"
require "webrat/rails/rails_session"
require "webrat/rails/session"

View File

@ -1,5 +1,3 @@
require "rubygems"
require "selenium"
require File.dirname(__FILE__) + "/selenium/selenium_session"
require "webrat/selenium/selenium_session"

View File

@ -1,14 +1,11 @@
require "rubygems"
require "spec"
require "spec/interop/test"
# 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")
require File.expand_path(File.dirname(__FILE__) + "/fakes/test_session")
require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat/merb/param_parser")
require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat/merb/url_encoded_pair_parser")
Spec::Runner.configure do |config|
# Nothing to configure yet

View File

@ -1,4 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../lib/webrat/mechanize")
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require "mechanize"
require "webrat/mechanize"
describe Webrat::MechanizeSession do
before(:each) do

View File

@ -1,4 +1,3 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/helper')
describe "attaches_file" do

View File

@ -1,7 +1,9 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require "active_support"
silence_warnings do
require "action_controller"
require "action_controller/integration"
end
require File.expand_path(File.dirname(__FILE__) + "/../../../lib/webrat/rails")
require "webrat/rails"

View File

@ -1,4 +1,3 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/helper')
describe Webrat::RailsSession do