gares 2.0.0.pre.dev3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +34 -25
- data/gares.gemspec +3 -2
- data/lib/attribute_accessors.rb +22 -0
- data/lib/gares/base.rb +68 -41
- data/lib/gares/errors.rb +14 -0
- data/lib/gares/search.rb +42 -12
- data/lib/gares/station.rb +1 -1
- data/lib/gares/train.rb +43 -18
- data/lib/gares/version.rb +1 -1
- data/lib/gares.rb +3 -3
- data/lib/string_extensions.rb +20 -0
- data/spec/fixtures/87723197.json +21 -0
- data/spec/fixtures/LYD-arrivals.json +17 -0
- data/spec/fixtures/LYD-departures.json +17 -0
- data/spec/fixtures/bls.csv +21484 -0
- data/spec/fixtures/get-train-12345 +219 -0
- data/spec/fixtures/post-train-12345 +0 -0
- data/spec/gares/search_spec.rb +94 -57
- data/spec/gares/station_spec.rb +61 -0
- data/spec/gares/train_spec.rb +25 -4
- data/spec/spec_helper.rb +14 -16
- data/tasks/fixtures.rake +4 -3
- metadata +31 -21
- data/lib/gares/sales.rb +0 -15
- data/lib/gares/services.rb +0 -15
- data/lib/gares/string_extensions.rb +0 -22
- data/spec/fixtures/frabt +0 -330
- data/spec/fixtures/frabt-services-vente +0 -12
- data/spec/fixtures/frhco +0 -346
- data/spec/fixtures/frlpd +0 -349
- data/spec/fixtures/frlpd-services +0 -462
- data/spec/fixtures/frlpd-services-vente +0 -399
- data/spec/fixtures/frqxb-services +0 -386
- data/spec/fixtures/frqxb-services-vente +0 -367
- data/spec/fixtures/frxag +0 -333
- data/spec/fixtures/search +0 -5254
- data/spec/gares/gare_spec.rb +0 -79
- data/spec/gares/sales_spec.rb +0 -11
data/spec/gares/gare_spec.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
# This test uses "Lyon Part-Dieu" as a testing sample:
|
6
|
-
#
|
7
|
-
# http://www.gares-en-mouvement.com/fr/frlpd/votre-gare/
|
8
|
-
#
|
9
|
-
describe Gares::Station do
|
10
|
-
|
11
|
-
describe 'valid gare' do
|
12
|
-
|
13
|
-
before(:each) do
|
14
|
-
# Get gare de Lyon Part-Dieu
|
15
|
-
@gare = Gares::Station.search_by_sncf_id('frlpd').first
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should find the name' do
|
19
|
-
name = @gare.name
|
20
|
-
|
21
|
-
expect(name).to eql('Lyon Part-Dieu')
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should find the geolocation coordinates' do
|
25
|
-
lat = @gare.latitude
|
26
|
-
long = @gare.longitude
|
27
|
-
|
28
|
-
expect(lat).to eql(45.760568)
|
29
|
-
expect(long).to eql(4.859991)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should have opening hours' do
|
33
|
-
horaires = @gare.horaires
|
34
|
-
|
35
|
-
expect(horaires.first).to eql('du lundi au dimanche de 04:50 à 00:45')
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should have a list of services' do
|
39
|
-
services = @gare.services
|
40
|
-
|
41
|
-
expect(services).to be_an(Array)
|
42
|
-
expect(services.first).to_not be_blank
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should have a list of sales services' do
|
46
|
-
sales = @gare.sales
|
47
|
-
|
48
|
-
expect(sales).to be_an(Array)
|
49
|
-
expect(sales.first).to_not be_blank
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'Station of Agde' do
|
53
|
-
before(:each) do
|
54
|
-
# Get gare de Agde
|
55
|
-
@gare = Gares::Station.search_by_sncf_id('frxag').first
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'a gare without wifi nor defibrillator' do
|
59
|
-
it { expect(@gare.wifi?).to be(false) }
|
60
|
-
it { expect(@gare.defibrillator?).to be(false) }
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'a gare with no sales services' do
|
64
|
-
it { expect(@gare.has_borne?).to be(false) }
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe 'with name that has utf-8 characters' do
|
70
|
-
# Belleville sur Sâone
|
71
|
-
before(:each) do
|
72
|
-
@gare = Gares::Station.search('Saone').first
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should give the proper name' do
|
76
|
-
expect(@gare.name).to eql('Port-sur-Saône')
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|