Sha256: a8518b9829e32658dfe67172b3ef01af20fe581a3aadb655a6f4542cbc47b79c

Contents?: true

Size: 1.9 KB

Versions: 6

Compression:

Stored size: 1.9 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Sequel do

  describe "has method 'fos' that" do
    before :each do
      @db = Sequel.fos('fos')
    end

    it "instantiates a fos/pervasive db from an odbc name" do
      @db.should_not be nil
    end

    it "actually works to see a fos table" do
      TripLeg.db=@db
      TripLeg.first.should_not be nil
    end
  end

#  describe "has method 'fos_dbr' that" do
#    before :each do
#      hash = {:host=>"localhost", :user=>'root', :password=>'', :database=>'test'}
#      @db = Sequel.fos_dbr(hash)
#    end
#
#    it "instantiates dbr/mysql db from hash of params name" do
#      @db.should_not be nil
#    end
#
#    it "actually works to see dbr tables" do
#      [TripLeg,Trip,Aircraft,Code,CrewLeg].each{|model| model.db=@db}
#      TripLeg.first.should_not be nil
#      TripLeg.first.trip.should_not be nil
##      p TripLeg.select(:trip_number).eager_graph(:trip).sql
##      p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").first
##      p TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).sql
##      t = TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).all.first
##      p [t.status,t.division,t.regulation,t.closed,t.ete,t.department,t.deadhead,t.company]
##      p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").eager_graph(:aircraft).all.first
##      TripLeg.filter(:'trip legs__kid_date'=>40475..40475, :cancel_code=>0,:leg_type_code=>7).eager_graph(:crew_legs=>:position_code).all.size.should == 3
#    end
#  end

  it "set_db method finds sets db on all Sequel models" do
    db = Sequel.fos('fos')
    Sequel.set_db db
    Trip.db.should == db
  end

  it "converts fos_id to key that can be used to query model" do
    Sequel.fos_id_to_lookup_key("MERE-0-8-40443-1259").should == ['MERE',0,8,40443,1259]
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fossil-0.5.20 spec/sequel/core_patch_spec.rb
fossil-0.5.19 spec/sequel/core_patch_spec.rb
fossil-0.5.18 spec/sequel/core_patch_spec.rb
fossil-0.5.17 spec/sequel/core_patch_spec.rb
fossil-0.5.16 spec/sequel/core_patch_spec.rb
fossil-0.5.15 spec/sequel/core_patch_spec.rb