spec/temp_spec.rb in fossil-0.5.48 vs spec/temp_spec.rb in fossil-0.5.49
- old
+ new
@@ -1,29 +1,42 @@
-require_relative '../spec_dbr/spec_helper'
-#require 'spec_helper'
+#require_relative '../spec_dbr/spec_helper'
+require 'spec_helper'
describe "FOS Licensing" do
before :all do
-# set_fos_db([TripLeg, FlightLogExpense, Vendor, AirportFbo])
+ set_fos_db([CityPair])
# set_dbr_db([TripLeg, FlightLogExpense, Aircraft, Vendor, AirportFbo])
# db = Sequel.fos_dbr(:username => 'datamart', :password => 'datap@ss', :adapter => 'mysql', :host => 'hrkdm', :database => 'dbr')
# db.loggers=[Logger.new($stdout)]
# [TripLeg, FlightLogExpense, Aircraft, Vendor, AirportFbo, AirportFuel].each { |m| m.db = db }
end
- it "pass a block to include?" do
- fbos = ["ATLANTIC AVIATION SERVIC", "SIGNATURE FLIGHT SUPPORT", "LANDMARK AVIATION"]
- search = "LANDMARK AVIATION EAST"
+ it "exports the fos city pairs table" do
+ File.open("city_pairs.csv", "w") do |f|
+ csv = ""
+ attributes = CityPair.first.keys
+ csv << attributes.to_flat_file_row( :delimeter => ',', :enclosed_by => '"') + "\n"
- result = nil
- fbos.each do |fbo|
- result = fbo and break if search.match(/^#{fbo}.*/)
+ CityPair.find_all.each do |cp|
+ csv << attributes.inject("") {|str, attr| str << "\"#{cp.send(attr)}\"," }.chop + "\n"
+ end
+ f.print(csv)
end
-
- p result
end
+ #it "pass a block to include?" do
+ #fbos = ["ATLANTIC AVIATION SERVIC", "SIGNATURE FLIGHT SUPPORT", "LANDMARK AVIATION"]
+ #search = "LANDMARK AVIATION EAST"
+
+ #result = nil
+ #fbos.each do |fbo|
+ #result = fbo and break if search.match(/^#{fbo}.*/)
+ #end
+
+ #p result
+ #end
+
# it "puts the lotion on the skin" do
# legs = TripLeg.fuel_passdown_data(Date.parse('2011-02-06'), Date.parse('2011-02-06'), ["SIGNATURE FLIGHT SUPPORT"])
# p "BLAH BLAH BLAH"
# pp legs
@@ -42,6 +55,6 @@
# end
#
# it "gets the aircraft licensing information" do
# print Aircraft.select(:tail_number, :mobile_access).sql
# end
-end
\ No newline at end of file
+end