Class: ODDB::State::Companies::TestCompanyListState

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

Defined Under Namespace

Classes: StubApp, StubCompany, StubPointer, StubSession

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'test/test_state/companies/companylist.rb', line 54

def setup
  @session = StubSession.new
  @company1 = StubCompany.new 
  @company2 = StubCompany.new 
  @company3 = StubCompany.new 
  @company4 = StubCompany.new 
  @company5 = StubCompany.new 
  @company1.name = 'Ywesee'
  @company2.name = 'lacarte'
  @company3.name = 'tt'
  @company4.name = '3m'
  @company5.name = 'tt'
  @session.app.companies = {
    @company1.name =>  @company1,
    @company2.name =>  @company2,
    @company3.name =>  @company3,
    @company4.name =>  @company4,
    @company5.name =>  @company5,
  }
  @session.user = State::Companies::RootUser.new
end

- (Object) test_default_interval



80
81
82
83
# File 'test/test_state/companies/companylist.rb', line 80

def test_default_interval
  @state = State::Companies::CompanyList.new(@session, @company)
  assert_equal('a-d', @state.default_interval)
end

- (Object) test_intervals



75
76
77
78
79
# File 'test/test_state/companies/companylist.rb', line 75

def test_intervals
  @state = State::Companies::CompanyList.new(@session, @company)
  expected = ['a-d', 'm-p', 'u-z', 'unknown']
  assert_equal(expected, @state.intervals)
end

- (Object) test_sent_model



89
90
91
92
93
94
# File 'test/test_state/companies/companylist.rb', line 89

def test_sent_model
  @session.user_input = { :range  => 'u-z' } 
  @state = State::Companies::TestCompanyList.new(@session, @company)
  expected = [ @company1, @company5 ]
  assert_equal( expected, @state.sent_model )
end

- (Object) test_user_input



84
85
86
87
88
# File 'test/test_state/companies/companylist.rb', line 84

def test_user_input
  @session.user_input = { :range  => 'u-z' } 
  @state = State::Companies::CompanyList.new(@session, @company)
  assert_equal( 'u-z', @state.range )
end