Class: ODDB::View::Drugs::TestResultList

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

Defined Under Namespace

Classes: StubAtc, StubCompany, StubFachinfo, StubLimitationText, StubPackage, StubSession

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



177
178
179
180
181
182
183
184
185
# File 'test/test_view/drugs/resultlist.rb', line 177

def setup
  @package = StubPackage.new
  @package.name_base = 'foo'
  @package.active_agents = []
  @model = StubAtc.new
  @model.packages = [@package]
  @session = StubSession.new
  @list = View::Drugs::ResultList.new([@model], @session)
end

- (Object) test_limitation_text

def test_fachinfo

    # 2 Voraussetzungen:
    # - Fachinfo vorhanden?
    # - Company erlaubt display?
    fi = StubFachinfo.new
    @session.dictionary = { :fachinfo_short=> 'FI'}
    company = StubCompany.new
    @package.company = company
    assert_nil(@list.fachinfo(@package, @session))
    @package.fachinfo = fi
    assert_nil(@list.fachinfo(@package, @session))
    company.fi_status = true
    link = @list.fachinfo(@package, @session)
    assert_instance_of(HtmlGrid::PopupLink, link)
    assert_equal('FI', link.value)
    @package.fachinfo = nil
    assert_nil(@list.fachinfo(@package, @session))
  end


209
210
211
212
213
214
215
216
217
218
219
# File 'test/test_view/drugs/resultlist.rb', line 209

def test_limitation_text
  li = StubLimitationText.new
  @session.dictionary = { :limitation_text_short=> '!'}
  assert_nil(@list.limitation_text(@package, @session))
  @package.sl_entry.limitation_text = li
  link = @list.limitation_text(@package, @session)
  assert_instance_of(HtmlGrid::PopupLink, link)
  assert_equal('!', link.value)
  @package.sl_entry.limitation_text = nil
  assert_nil(@list.limitation_text(@package, @session))
end

- (Object) test_price_format



186
187
188
# File 'test/test_view/drugs/resultlist.rb', line 186

def test_price_format
  assert_equal('678.90', @list.price_public(@package, nil).value)
end