spec/gares/station_spec.rb in gares-2.0.0.pre.2 vs spec/gares/station_spec.rb in gares-2.0.0
- old
+ new
@@ -1,18 +1,16 @@
require 'spec_helper'
# This test uses "Lyon Part-Dieu" as a testing sample:
#
-# http://www.gares-en-mouvement.com/fr/frlpd/votre-gare/
-#
describe Gares::Station do
describe 'valid gare' do
subject do
# Get gare de Lyon Part-Dieu
- Gares::Station.search_by_sncf_id('frlpd').first
+ Gares::Station.find_by_sncf_id('frlpd')
end
it 'should find the name' do
expect(subject.name).to eql('Lyon Part-Dieu')
end
@@ -21,43 +19,42 @@
expect(subject.sncf_id).to eql('FRLPD')
# Still supports deprecated fields
expect(subject.slug).to eql(subject.sncf_id.downcase)
end
+ it 'should find the TVS number' do
+ expect(subject.send(:tvs)).to eql('LYD')
+ end
+
it 'should find the geolocation coordinates' do
expect(subject.latitude).to eql(45.760568)
expect(subject.longitude).to eql(4.859991)
# Still supports deprecated fields
expect(subject.lat).to eql(subject.latitude)
expect(subject.long).to eql(subject.longitude)
end
- it 'should have opening hours' do
- expect(subject.horaires.first).to eql('du lundi au dimanche de 04:50 à 00:45')
+ it 'has a list of departure trains' do
+ expect(subject.departures.size).to eq(20)
+ expect(subject.departures.first.origdest.name).to eq('Bruxelles')
+ expect(subject.departures.first.heure).to eq('05:50')
+ expect(subject.departures.first.type).to eq('TGV')
end
- it 'should have a list of services' do
- expect(subject.services).to be_an(Array)
- expect(subject.services.first).to_not be_blank
+ it 'has a list of arrivals' do
+ expect(subject.arrivals.last.origdest.name).to eq('Chambéry Challes-les-Eaux')
+ expect(subject.arrivals.last.voie).to eq('')
+ expect(subject.arrivals.last.platform).to eq(subject.arrivals.last.voie)
+ expect(subject.arrivals.last.num).to eq(18542)
end
- it 'should have a list of sales services' do
- expect(subject.sales).to be_an(Array)
- expect(subject.sales.first).to_not be_blank
- end
-
context 'Station of Agde' do
subject do
# Get gare de Agde
- Gares::Station.search_by_sncf_id('frxag').first
+ Gares::Station.find_by_sncf_id('frxag')
end
- describe 'a gare without wifi nor defibrillator' do
- it { expect(subject.wifi?).to be(false) }
- it { expect(subject.defibrillator?).to be(false) }
- end
-
- describe 'a gare with no sales services' do
+ describe 'a gare with a BLS' do
it { expect(subject.has_borne?).to be(true) }
end
end
end
end