spec/ratis/next_bus_spec.rb in ratis-3.3.3 vs spec/ratis/next_bus_spec.rb in ratis-3.3.4
- old
+ new
@@ -2,26 +2,49 @@
describe Ratis::NextBus do
before do
Ratis.reset
Ratis.configure do |config|
- config.endpoint = 'http://soap.valleymetro.org/cgi-bin-soap-web-252/soap.cgi'
+ config.endpoint = 'http://soap.valleymetro.org/cgi-bin-soap-web-262/soap.cgi'
config.namespace = 'PX_WEB'
end
@time = Chronic.parse('next monday at 6am')
end
let(:empty_body){ {:nextbus_response => {:atstop => {:service => []}}} }
+ describe "Developer can find a late bus to a stop" do
+ it "will give developer happiness :-)" do
+
+ @conditions = {:app_id => 'ratis-specs', # a short string that can be used to separate requests from different applications or different modules with
+ :type => 'N',
+ :datetime => Chronic.parse('now') }
+
+ require 'pp'
+ 10000.upto(10100).each do |id|
+ puts id
+ response = Ratis::NextBus.where(@conditions.dup.merge(:stop_id => id)) rescue next
+
+ response.services.each do |service|
+ service.trips.each do |trip|
+ if trip.realtime.valid != 'N'
+ puts trip.realtime
+ end
+ end
+ end
+ end
+ end
+ end
+
describe '#success?' do
it "do something" do
pending
end
end
- describe '#where' do
+ describe '#where', {:vcr => {:cassette_name => "Nextbus_running_LATE", :re_record_interval => 6.months}} do #
# TODO: Light Rails Stops can return 2 Atstop tags... how do we best handle this case
describe 'Light Rails stops' do
it "description" do
pending
end
@@ -180,28 +203,28 @@
service = response.services.first
expect(service).to be_a(OpenStruct)
expect(service.status).to eq('N')
- expect(service.sign).to eq('108 Elliot/48th St West To 40th St/Pecos')
+ expect(service.sign).to eq('0 CENTRAL North to Dunlap/3rd St.')
expect(service.routetype).to eq('B')
- expect(service.times).to eq("07:07 AM, 03:07 PM, 03:37 PM, 04:07 PM")
- expect(service.direction).to eq('W')
+ expect(service.times).to eq("05:49 AM, 06:09 AM, 06:29 AM, 06:49 AM")
+ expect(service.direction).to eq('N')
expect(service.servicetype).to eq('W')
- expect(service.route).to eq('108')
- expect(service.operator).to eq('FTE')
+ expect(service.route).to eq('ZERO')
+ expect(service.operator).to eq('AP')
service = response.services.last
expect(service).to be_a(OpenStruct)
expect(service.status).to eq('N')
- expect(service.sign).to eq('108 Elliot/48th St West To 48th St/Chandler Via Sosmn/Bsnln')
+ expect(service.sign).to eq('0 CENTRAL North to Dunlap/3rd St.')
expect(service.routetype).to eq('B')
- expect(service.times).to eq("02:37 PM, 06:37 PM")
- expect(service.direction).to eq('W')
+ expect(service.times).to eq("05:49 AM, 06:09 AM, 06:29 AM, 06:49 AM")
+ expect(service.direction).to eq('N')
expect(service.servicetype).to eq('W')
- expect(service.route).to eq('108')
- expect(service.operator).to eq('FTE')
+ expect(service.route).to eq('ZERO')
+ expect(service.operator).to eq('AP')
end
it "should raise error if datetime condition is not a DateTime or Time" do
lambda {
Ratis::NextBus.where(@conditions.dup.merge(:datetime => '01/01/2013'))