spec/ratis/next_bus_spec.rb in ratis-3.3.6 vs spec/ratis/next_bus_spec.rb in ratis-3.3.7

- old
+ new

@@ -13,11 +13,11 @@ let(:empty_body){ {:nextbus_response => {:atstop => {:service => []}}} } describe "Developer can find a late bus to a stop" do it "will give developer happiness :-)" do - + pending @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' @@ -40,11 +40,11 @@ it "do something" do pending end end - describe '#where', {:vcr => {:cassette_name => "Nextbus_running_LATE", :re_record_interval => 6.months}} do # + describe '#where', vcr: {} 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 @@ -111,11 +111,11 @@ response = Ratis::NextBus.where(@conditions.dup) service = response.services.first expect(response).to be_a(Ratis::NextBus) expect(response.services).to be_a(Array) - expect(service.status).to eq('N') + expect(service.status).to eq('D') expect(service.sign).to eq('0 CENTRAL North to Dunlap/3rd St.') expect(service.routetype).to eq('B') 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') @@ -128,15 +128,15 @@ Ratis::NextBus.where(@conditions.dup.merge(:datetime => '01/01/2013')) }.should raise_error(ArgumentError, 'If datetime supplied it should be a Time or DateTime instance, otherwise it defaults to Time.now') lambda { Ratis::NextBus.where(@conditions.dup.merge(:datetime => Time.now)) - }.should_not raise_error(ArgumentError) + }.should_not raise_error lambda { - Ratis::NextBus.where(@conditions.dup.merge(:datetime => DateTime.today)) - }.should_not raise_error(ArgumentError) + Ratis::NextBus.where(@conditions.dup.merge(:datetime => Date.today.to_time)) + }.should_not raise_error end it "should raise error if stop id is not provided" do lambda { Ratis::NextBus.where(@conditions.dup.merge(:stop_id => nil)) @@ -203,43 +203,43 @@ service = response.services.first expect(service).to be_a(OpenStruct) expect(service.status).to eq('N') - expect(service.sign).to eq('0 CENTRAL North to Dunlap/3rd St.') + expect(service.sign).to eq('108 Elliot/48th St West To 40th St/Pecos') expect(service.routetype).to eq('B') - 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.times).to eq("07:07 AM, 03:07 PM, 03:37 PM, 04:07 PM") + expect(service.direction).to eq('W') expect(service.servicetype).to eq('W') - expect(service.route).to eq('ZERO') - expect(service.operator).to eq('AP') + expect(service.route).to eq('108') + expect(service.operator).to eq('FTE') service = response.services.last expect(service).to be_a(OpenStruct) expect(service.status).to eq('N') - expect(service.sign).to eq('0 CENTRAL North to Dunlap/3rd St.') + expect(service.sign).to eq('108 Elliot/48th St West To 48th St/Chandler Via Sosmn/Bsnln') expect(service.routetype).to eq('B') - 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.times).to eq("02:37 PM, 06:37 PM") + expect(service.direction).to eq('W') expect(service.servicetype).to eq('W') - expect(service.route).to eq('ZERO') - expect(service.operator).to eq('AP') + expect(service.route).to eq('108') + expect(service.operator).to eq('FTE') 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')) }.should raise_error(ArgumentError, 'If datetime supplied it should be a Time or DateTime instance, otherwise it defaults to Time.now') lambda { Ratis::NextBus.where(@conditions.dup.merge(:datetime => Time.now)) - }.should_not raise_error(ArgumentError) + }.should_not raise_error lambda { - Ratis::NextBus.where(@conditions.dup.merge(:datetime => DateTime.today)) - }.should_not raise_error(ArgumentError) + Ratis::NextBus.where(@conditions.dup.merge(:datetime => Date.today.to_time)) + }.should_not raise_error end it "should raise error if stop id is not provided" do lambda { Ratis::NextBus.where(@conditions.dup.merge(:stop_id => nil)) @@ -259,11 +259,9 @@ expect(Ratis::NextBus.where(@conditions.dup).services).to be_empty end end end - - end # EXAMPLE RESPONSE # {:envelope => {