Class: ODDB::State::Drugs::TestMergeGalenicFormState

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



44
45
46
47
48
49
# File 'test/test_state/drugs/mergegalenicform.rb', line 44

def setup
  @session = StubMGFStateSession.new
  @model = StubMGFStateModel.new('Filmtabletten')
  @state = State::Drugs::MergeGalenicForm.new(@session, @model)
  @session.user_input = {:galenic_form => "Tabletten"}
end

- (Object) test_no_target



50
51
52
53
54
# File 'test/test_state/drugs/mergegalenicform.rb', line 50

def test_no_target
  newstate = @state.trigger(:merge)
  assert_equal(false, @session.merge_galenic_forms_called)
  assert_equal(@state, newstate)
end

- (Object) test_same_target



55
56
57
58
59
60
61
# File 'test/test_state/drugs/mergegalenicform.rb', line 55

def test_same_target
  @model.form = 'Tabletten'
  @session.galenic_forms = { "Tabletten" => @model }
  newstate = @state.trigger(:merge)
  assert_equal(false, @session.merge_galenic_forms_called)
  assert_equal(@state, newstate)
end

- (Object) test_target



62
63
64
65
66
67
# File 'test/test_state/drugs/mergegalenicform.rb', line 62

def test_target
  @session.galenic_forms = { "Tabletten" => StubMGFStateModel.new('Tabletten') }
  newstate = @state.trigger(:merge)
  assert_equal(true, @session.merge_galenic_forms_called)
  assert_equal(State::Drugs::GalenicForm, newstate.class)
end