Class: ODDB::View::Drugs::TestFachinfoConfirm

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
test/test_view/drugs/fachinfoconfirm.rb

Defined Under Namespace

Classes: StubSession

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



49
50
51
52
# File 'test/test_view/drugs/fachinfoconfirm.rb', line 49

def setup
  @session = StubSession.new
  @form = View::Drugs::FachinfoConfirmForm.new(nil, @session)
end

- (Object) test_compose_footer1



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'test/test_view/drugs/fachinfoconfirm.rb', line 53

def test_compose_footer1
  grid = @form.grid = HtmlGrid::Grid.new()
  grid.add(nil, 3,0)
  @form.compose_footer([0,0])
  html = @form.to_html(CGI.new)
  expected = [
    '<FORM ACCEPT-CHARSET="ISO-8859-1" NAME="stdform" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded"><TABLE cellspacing="0" class="composite"><TR><TD colspan="4">',
    '<INPUT name="back" onClick="document.location.href=\'back\';" type="button" value="lookup">',
    '<INPUT name="update" type="submit" value="lookup">',
  ]
  expected.each { |line| 
    assert(html.index(line), "missing: #{line}\nin:\n#{html}")
  }
end

- (Object) test_compose_footer2



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'test/test_view/drugs/fachinfoconfirm.rb', line 67

def test_compose_footer2
  grid = @form.grid = HtmlGrid::Grid.new
  grid.add(nil, 3,0)
  @session.error = true
  @form.compose_footer([0,0])
  html = @form.to_html(CGI.new)
  expected = [
    '<FORM ACCEPT-CHARSET="ISO-8859-1" NAME="stdform" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded"><TABLE cellspacing="0" class="composite"><TR><TD colspan="4">',
    '<INPUT name="back" onClick="document.location.href=\'back\';" type="button" value="lookup">',
  ]
  expected.each { |line| 
    assert(html.index(line), "missing: #{line}\nin:\n#{html}")
  }
  line = '<INPUT name="update" type="submit" value="lookup">'
  assert_nil(html.index(line), "found: #{line}\nin:\n#{html}\n...but it should not be there!")
end