diff options
| author | cedricnjanga | 2017-09-29 16:44:16 +0200 |
|---|---|---|
| committer | cedricnjanga | 2017-09-29 16:44:31 +0200 |
| commit | 5f8fec15211d8ee8641a090c752eb6480979b74e (patch) | |
| tree | ac68835ce4a9cd646aa2b6980bbe5c9dcbdd3adc | |
| parent | e50707e425bbece28273d7f3a2cff3e8b5cd3ccb (diff) | |
| download | chouette-core-5f8fec15211d8ee8641a090c752eb6480979b74e.tar.bz2 | |
Add instance methods to collect transport modes in StifTransportMode module
| -rw-r--r-- | app/models/concerns/stif_transport_mode_enumerations.rb | 4 | ||||
| -rw-r--r-- | app/models/concerns/stif_transport_submode_enumerations.rb | 4 | ||||
| -rw-r--r-- | spec/models/line_referential_spec.rb | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/app/models/concerns/stif_transport_mode_enumerations.rb b/app/models/concerns/stif_transport_mode_enumerations.rb index 20154af97..dc573b3a0 100644 --- a/app/models/concerns/stif_transport_mode_enumerations.rb +++ b/app/models/concerns/stif_transport_mode_enumerations.rb @@ -3,4 +3,8 @@ module StifTransportModeEnumerations extend Enumerize enumerize :transport_mode, in: %w(air bus coach ferry metro rail trolleyBus tram water cableway funicular other) + + def transport_modes + StifTransportModeEnumerations.transport_mode.options.map(&:first) + end end diff --git a/app/models/concerns/stif_transport_submode_enumerations.rb b/app/models/concerns/stif_transport_submode_enumerations.rb index 90eb60dba..a150381f3 100644 --- a/app/models/concerns/stif_transport_submode_enumerations.rb +++ b/app/models/concerns/stif_transport_submode_enumerations.rb @@ -3,4 +3,8 @@ module StifTransportSubmodeEnumerations extend Enumerize enumerize :transport_submode, in: %w(unknown undefined internationalFlight domesticFlight intercontinentalFlight domesticScheduledFlight shuttleFlight intercontinentalCharterFlight internationalCharterFlight roundTripCharterFlight sightseeingFlight helicopterService domesticCharterFlight SchengenAreaFlight airshipService shortHaulInternationalFlight canalBarge localBus regionalBus expressBus nightBus postBus specialNeedsBus mobilityBus mobilityBusForRegisteredDisabled sightseeingBus shuttleBus highFrequencyBus dedicatedLaneBus schoolBus schoolAndPublicServiceBus railReplacementBus demandAndResponseBus airportLinkBus internationalCoach nationalCoach shuttleCoach regionalCoach specialCoach schoolCoach sightseeingCoach touristCoach commuterCoach metro tube urbanRailway local highSpeedRail suburbanRailway regionalRail interregionalRail longDistance intermational sleeperRailService nightRail carTransportRailService touristRailway railShuttle replacementRailService specialTrain crossCountryRail rackAndPinionRailway cityTram localTram regionalTram sightseeingTram shuttleTram trainTram internationalCarFerry nationalCarFerry regionalCarFerry localCarFerry internationalPassengerFerry nationalPassengerFerry regionalPassengerFerry localPassengerFerry postBoat trainFerry roadFerryLink airportBoatLink highSpeedVehicleService highSpeedPassengerService sightseeingService schoolBoat cableFerry riverBus scheduledFerry shuttleFerryService telecabin cableCar lift chairLift dragLift telecabinLink funicular streetCableCar allFunicularServices undefinedFunicular) + + def transport_submodes + StifTransportSubmodeEnumerations.transport_submode.options.map(&:first) + end end diff --git a/spec/models/line_referential_spec.rb b/spec/models/line_referential_spec.rb index 292ecd497..07725d9e6 100644 --- a/spec/models/line_referential_spec.rb +++ b/spec/models/line_referential_spec.rb @@ -12,7 +12,7 @@ RSpec.describe LineReferential, :type => :model do describe "#transport_modes" do it 'returns a list of all transport modes' do - expect(FactoryGirl.create(:line_referential).transport_mode).to match_array(StifTransportModeEnumerations.transport_mode ) + expect(FactoryGirl.create(:line_referential).transport_modes).to match_array(StifTransportModeEnumerations.transport_mode.options.map(&:first) ) end end end |
