Class: ODDB::State::Admin::TestCompanyUserState

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

Defined Under Namespace

Classes: StubSession

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



28
29
30
31
# File 'test/test_state/admin/companyuser.rb', line 28

def setup
  @session = StubSession.new
  @state = State::Drugs::Init.new(@session, [1,11,2,22,3,33])
end

- (Object) test_extend_state



32
33
34
35
# File 'test/test_state/admin/companyuser.rb', line 32

def test_extend_state
  @state.extend(State::Admin::CompanyUser)
  assert(@state.is_a?(State::Admin::CompanyUser), 'extend did not work')
end

- (Object) test_login



36
37
38
39
40
41
# File 'test/test_state/admin/companyuser.rb', line 36

def 
  @state.extend(State::Admin::CompanyUser)
  state = @state.trigger(:login_form)
  assert_equal(State::Admin::, state.class)
  assert(state.is_a?(State::Admin::CompanyUser), 'trigger did not pass on CompanyUserState')
end

- (Object) test_logout



42
43
44
45
46
47
48
# File 'test/test_state/admin/companyuser.rb', line 42

def test_logout
  @state.extend(State::Admin::CompanyUser)
  state = @state.trigger(:logout)
  assert_equal(State::Drugs::Init, state.class)
  assert(!state.is_a?(State::Admin::CompanyUser), 'should not include CompanyUserState after logout')
  state = @state.trigger(:login)
end

- (Object) test_new_registration



49
50
51
52
53
# File 'test/test_state/admin/companyuser.rb', line 49

def test_new_registration
  @state.extend(State::Admin::CompanyUser)
  regstate = @state.new_registration
  assert_equal('user_model', regstate.model.company_name)
end