Class: TestIngresQuerySimple

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/tests/tc_query_simple.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



7
8
9
10
# File 'ext/tests/tc_query_simple.rb', line 7

def setup
  @@ing = Ingres.new()
  assert_kind_of(Ingres, @@ing.connect(@@database, @@username, @@password), "conn is not an Ingres object")
end

#teardownObject



12
13
14
# File 'ext/tests/tc_query_simple.rb', line 12

def teardown
  @@ing.disconnect
end

#test_query_usernameObject



16
17
18
19
# File 'ext/tests/tc_query_simple.rb', line 16

def test_query_username
  # ing.execute returns and array so we want the first and only element
  assert_equal @@username, @@ing.execute("select dbmsinfo('session_user')").flatten[0]
end

#test_tablesObject



21
22
23
24
25
26
27
# File 'ext/tests/tc_query_simple.rb', line 21

def test_tables
  if @@database == "demodb"
    assert_not_nil @@ing.tables.include? "airport"
    assert_not_nil @@ing.tables.include? "country"
    assert_not_nil @@ing.tables.include? "user_profile"
  end
end