aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/import
diff options
context:
space:
mode:
authorAlban Peignier2018-04-02 23:19:48 +0200
committerAlban Peignier2018-04-02 23:19:48 +0200
commit1e9ed69dc7509ffc6c0ae1a401c04d57dbbea45a (patch)
treeed5eabf542ba844eafd605620cbc35dd72e4134f /spec/models/import
parentecba5b99bb8eae41507d1040f32584472b740d26 (diff)
downloadchouette-core-1e9ed69dc7509ffc6c0ae1a401c04d57dbbea45a.tar.bz2
Import TimeTableDates from calendar dates. Refs #6368
Diffstat (limited to 'spec/models/import')
-rw-r--r--spec/models/import/gtfs_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/import/gtfs_spec.rb b/spec/models/import/gtfs_spec.rb
index 934f13c1d..f2404b771 100644
--- a/spec/models/import/gtfs_spec.rb
+++ b/spec/models/import/gtfs_spec.rb
@@ -220,6 +220,31 @@ RSpec.describe Import::Gtfs do
end
end
+ describe "#import_calendar_dates" do
+ let(:import) { create_import "google-sample-feed.zip" }
+
+ before do
+ import.prepare_referential
+ import.import_calendars
+ end
+
+ it "should create a Timetable::Date for each calendar date" do
+ import.import_calendar_dates
+
+ def d(value)
+ Date.parse(value)
+ end
+
+ defined_attributes = ->(d) {
+ [d.time_table.comment, d.date, d.in_out]
+ }
+ expected_attributes = [
+ ["Calendar FULLW", d("Mon, 04 Jun 2007"), false]
+ ]
+ expect(referential.time_table_dates.map(&defined_attributes)).to eq(expected_attributes)
+ end
+ end
+
describe "#download_local_file" do
let(:file) { "google-sample-feed.zip" }