Skip to content
Browse files

Fixing tests to load the just built extension (and some resource use …

…optimizations)
  • Loading branch information...
1 parent 5178521 commit 6d25df8e8359fd0ffb76910afe3ff696acded55d @santana committed
View
4 test/ifx_all.rb
@@ -1,5 +1,7 @@
testdir = File.expand_path(File.dirname(__FILE__))
-$LOAD_PATH.unshift File.join(testdir, "..")
+$LOAD_PATH.unshift testdir
+$LOAD_PATH.unshift File.expand_path(File.join(testdir, "..", "lib"))
+$LOAD_PATH.unshift File.expand_path(File.join(testdir, "..", "ext"))
require 'informix'
gem 'test-unit'
View
2 test/ifx_test_create_table.rb
@@ -1,8 +1,6 @@
testdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift testdir
-$LOAD_PATH.unshift File.join(testdir, "..")
-require 'informix'
require 'testcase'
class IfxTestCreate < Informix::TestCase
View
2 test/ifx_test_errinfo.rb
@@ -1,8 +1,6 @@
testdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift testdir
-$LOAD_PATH.unshift File.join(testdir, "..")
-require 'informix'
require 'testcase'
# Informix::ExcInfo is just a struct, not much testing needed
View
2 test/ifx_test_exceptions.rb
@@ -1,8 +1,6 @@
testdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift testdir
-$LOAD_PATH.unshift File.join(testdir, "..")
-require 'informix'
require 'testcase'
class IfxTestExceptions < Informix::TestCase
View
4 test/ifx_test_fetch_n_each.rb
@@ -1,11 +1,7 @@
testdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift testdir
-$LOAD_PATH.unshift File.join(testdir, "..")
-require 'informix'
require 'testcase'
-require 'stringio'
-require 'date'
class IfxTestXFetchNEach < Informix::TestCase
def setup
View
4 test/ifx_test_insert.rb
@@ -1,11 +1,7 @@
testdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift testdir
-$LOAD_PATH.unshift File.join(testdir, "..")
-require 'informix'
require 'testcase'
-require 'stringio'
-require 'date'
class IfxTestInsert < Informix::TestCase
def setup
View
9 test/ifx_test_select.rb
@@ -1,11 +1,7 @@
testdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift testdir
-$LOAD_PATH.unshift File.join(testdir, "..")
-require 'informix'
require 'testcase'
-require 'stringio'
-require 'date'
class IfxTestSelect < Informix::TestCase
def setup
@@ -18,9 +14,8 @@ def setup
def test_select
rows = nil
-
assert_nothing_raised(Informix::Error, "Selecting records") do
- rows = db.cursor('select * from test').open.fetch_all
+ rows = db.cursor('select * from test') { |c| c.open; c.fetch_all }
end
assert_equal(2, rows.size, "# of records retrieved")
@@ -82,5 +77,3 @@ def test_select
end
end
end
-
-
View
6 test/testcase.rb
@@ -1,5 +1,7 @@
testdir = File.expand_path(File.dirname(__FILE__))
-$LOAD_PATH.unshift File.join(testdir, "..")
+$LOAD_PATH.unshift testdir
+$LOAD_PATH.unshift File.expand_path(File.join(testdir, "..", "lib"))
+$LOAD_PATH.unshift File.expand_path(File.join(testdir, "..", "ext"))
gem 'test-unit'
require 'test/unit'
@@ -105,7 +107,7 @@ def populate_test_table
sql = "insert into test values(#{"?," * (@rows[1].size - 1)}#{"?"})"
assert_nothing_raised(Informix::Error, "Inserting record with stmt.execute, sql = [#{sql}]") do
- db.prepare sql {|stmt| stmt.execute(*@rows[1]) }
+ db.prepare(sql) {|stmt| stmt.execute(*@rows[1]) }
end
ensure
rewind_data

0 comments on commit 6d25df8

Please sign in to comment.
Something went wrong with that request. Please try again.