Class: WebUnit::TestCase

Inherits:
Object show all
Includes:
WebUnit, Utils
Defined in:
lib/webunit/testcase.rb

Constant Summary

Constants included from WebUnit

AVAILABLE_FRAMEWORKS, AVAILABLE_XMLPARSERS, BOUNDARY, USING_XMLPARSER

Instance Method Summary collapse

Methods included from Utils

#complete_url, #orthop_url, #parse_url

Methods included from WebUnit

#assert_attrs, #assert_include, #assert_input, #assert_select_option, #assert_title, #assert_urls, dispatch, runtest

Constructor Details

#initialize(method, name = self.class.name) ⇒ TestCase

Returns a new instance of TestCase.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/webunit/testcase.rb', line 16

def initialize( method, name=self.class.name )
  case USING_FRAMEWORK
  when 'Test::Unit'
    super(method)
  when 'RubyUnit'
    super
  else
    super
    # raise??
  end
  @urlbase = ENV['URLBASE'] ? ENV['URLBASE'] : 'http://localhost/'
  @urlbase = orthop_url( @urlbase )
  @urlbase << '/' unless @urlbase =~ %r!/$!
  $stderr.puts "URLBASE is #{@urlbase}" if $DEBUG
end

Instance Method Details

#setupObject



32
33
34
35
36
# File 'lib/webunit/testcase.rb', line 32

def setup
  $URLBASE = @urlbase
  Response::reset
  @cookies_kept = Cookies::instance.cookies
end

#teardownObject



38
39
40
41
# File 'lib/webunit/testcase.rb', line 38

def teardown
  Response::reset
  Cookies::instance.cookies = @cookies_kept
end