Sha256: 64687fb33d97c745a6220fe4c9c3596d5d70ef2ce102197a8d5904b5998570eb

Contents?: true

Size: 1.28 KB

Versions: 17

Compression:

Stored size: 1.28 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)

AssertionFailedError = Test::Unit::AssertionFailedError rescue MiniTest::Assertion # ruby1.9 compat

require "webrat"
require File.expand_path(File.dirname(__FILE__) + "/fakes/test_adapter")

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

require "merb-core"

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

Version data entries

17 entries across 17 versions & 10 rubygems

Version Path
diabolo-webrat-0.5.1 spec/spec_helper.rb
revo-webrat-0.7.0.1 spec/spec_helper.rb
davidtrogers-webrat-0.7.0 spec/spec_helper.rb
revo-webrat-0.7.0 spec/spec_helper.rb
revo-webrat-0.7.1.pre spec/spec_helper.rb
webrat-0.7.0 spec/spec_helper.rb
honkster-webrat-0.6.0.10 spec/spec_helper.rb
honkster-webrat-0.6.0.9 spec/spec_helper.rb
darkofabijan-webrat-0.6.1 spec/spec_helper.rb
kbaum-webrat-0.5.1 spec/spec_helper.rb
kbaum-webrat-0.6.1.pre spec/spec_helper.rb
cynergy-webrat-0.6.0 spec/spec_helper.rb
webrat-0.6.0 spec/spec_helper.rb
radar-webrat-0.5.1.1 spec/spec_helper.rb
radar-webrat-0.5.1 spec/spec_helper.rb
mkuklis-webrat-0.5.1 spec/spec_helper.rb
honkster-webrat-0.6.0 spec/spec_helper.rb