Sha256: 30d3173266b2d03b91107acba0b8d89278d150177e183dfc145578ab756f1332

Contents?: true

Size: 1.16 KB

Versions: 23

Compression:

Stored size: 1.16 KB

Contents

require "rubygems"
require "test/unit"
require "spec"

# gem install redgreen for colored test output
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end

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")

module Webrat
  @@previous_config = nil

  def self.cache_config_for_test
    @@previous_config = Webrat.configuration.clone
  end

  def self.reset_for_test
    @@configuration = @@previous_config if @@previous_config
  end
end

Spec::Runner.configure do |config|
  include Webrat::Methods

  def with_html(html)
    raise "This doesn't look like HTML. Wrap it in a <html> tag" unless html =~ /^\s*<[^Hh>]*html/i
    webrat_session.response_body = html
  end

  def with_xml(xml)
    raise "This looks like HTML" if xml =~ /^\s*<[^Hh>]*html/i
    webrat_session.response_body = xml
  end

  config.before :each do
    Webrat.cache_config_for_test
  end

  config.after :each do
    Webrat.reset_for_test
  end
end

Webrat.configure do |config|
  config.mode = :merb
end

Version data entries

23 entries across 23 versions & 9 rubygems

Version Path
davidtrogers-webrat-0.4.4.2 spec/spec_helper.rb
diabolo-webrat-0.4.4.1 spec/spec_helper.rb
diabolo-webrat-0.4.4.2 spec/spec_helper.rb
diabolo-webrat-0.4.4 spec/spec_helper.rb
emipair-webrat-0.0.1 spec/spec_helper.rb
raldred-webrat-0.4.4.2 spec/spec_helper.rb
sr-webrat-0.4.4.1 spec/spec_helper.rb
winton-sum-0.1.0 vendor/webrat/spec/spec_helper.rb
winton-sum-0.1.1 vendor/webrat/spec/spec_helper.rb
sum-0.1.1 vendor/webrat/spec/spec_helper.rb
webrat-0.4.5 spec/spec_helper.rb
metry-2.0.4 vendor/webrat/spec/spec_helper.rb
metry-2.0.5 vendor/webrat/spec/spec_helper.rb
metry-2.1.0 vendor/webrat/spec/spec_helper.rb
metry-2.1.1 vendor/webrat/spec/spec_helper.rb
metry-2.0.0 vendor/webrat/spec/spec_helper.rb
metry-2.0.1 vendor/webrat/spec/spec_helper.rb
metry-2.0.2 vendor/webrat/spec/spec_helper.rb
metry-2.0.3 vendor/webrat/spec/spec_helper.rb
metry-1.0.0 vendor/webrat/spec/spec_helper.rb