Issue
Are there any tutorials or examples of testing Ruby OCI8 database services?
Solution
See "C:\RubyXXX\lib\ruby\gems\1.9.1\gems\ruby-oci8-2.1.0-x86-mingw32\test\test_oci8.rb" or wherever it is on your drive.
Lots of weblinks i'm not going to include, you can google them yourselve.
A very simple example
require 'oci8'
oci = OCI8.new('schema','password','db.server')
oci.exec('select * from table') do |record|
puts record.join(',')
end
Some unit testing for active-record and sqlite, you can adapt this for oci8
require 'active_record'
require "test/unit"
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => "sample.db"
)
class Album < ActiveRecord::Base;end
class Tester < Test::Unit::TestCase
def test_title
assert_equal('Sticky Fingers', Album.find_by_title('Sticky Fingers').title)
end
end
Answered By - peter Answer Checked By - Cary Denson (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.