aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/stif
diff options
context:
space:
mode:
authorLuc Donnet2018-02-19 11:04:29 +0100
committerLuc Donnet2018-02-19 11:04:29 +0100
commit7b17deff51545358009cb417cbb9d796565e7540 (patch)
treea43a5586ad39d838dd607e600dbc15ff18a58ab3 /spec/lib/stif
parent89428163fc93a7e09ebb0ca47939f8558afeb5eb (diff)
parent5f6008d165df4499319a2121a71842657d6ac3c9 (diff)
downloadchouette-core-7b17deff51545358009cb417cbb9d796565e7540.tar.bz2
Merge branch 'master' into 0000-docker
Diffstat (limited to 'spec/lib/stif')
-rw-r--r--spec/lib/stif/netex_file/frame_spec.rb13
-rw-r--r--spec/lib/stif/netex_file_spec.rb4
-rw-r--r--spec/lib/stif/permission_translator_spec.rb16
3 files changed, 32 insertions, 1 deletions
diff --git a/spec/lib/stif/netex_file/frame_spec.rb b/spec/lib/stif/netex_file/frame_spec.rb
new file mode 100644
index 000000000..506da2148
--- /dev/null
+++ b/spec/lib/stif/netex_file/frame_spec.rb
@@ -0,0 +1,13 @@
+require 'stif/netex_file'
+RSpec.describe STIF::NetexFile::Frame do
+
+ context "line object id extraction" do
+ it "gets the line object id if frame describes a line" do
+ expect( described_class.get_short_id('offre_C00109_10.xml') ).to eq('C00109')
+ end
+
+ it "gets nil if the frame does not describe a line" do
+ expect( described_class.get_short_id('commun.xml') ).to be_nil
+ end
+ end
+end
diff --git a/spec/lib/stif/netex_file_spec.rb b/spec/lib/stif/netex_file_spec.rb
index ef69b994c..850d0d3de 100644
--- a/spec/lib/stif/netex_file_spec.rb
+++ b/spec/lib/stif/netex_file_spec.rb
@@ -1,8 +1,9 @@
+require 'stif/netex_file'
RSpec.describe STIF::NetexFile do
let( :zip_file ){ fixtures_path 'OFFRE_TRANSDEV_2017030112251.zip' }
- let(:frames) { STIF::NetexFile.new(zip_file).frames }
+ let(:frames) { described_class.new(zip_file).frames }
it "should return a frame for each sub directory" do
expect(frames.size).to eq(2)
@@ -22,4 +23,5 @@ RSpec.describe STIF::NetexFile do
end
end
+
end
diff --git a/spec/lib/stif/permission_translator_spec.rb b/spec/lib/stif/permission_translator_spec.rb
index ae1a2d1d5..9771af187 100644
--- a/spec/lib/stif/permission_translator_spec.rb
+++ b/spec/lib/stif/permission_translator_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
RSpec.describe Stif::PermissionTranslator do
context "No SSO Permissions" do
@@ -42,4 +43,19 @@ RSpec.describe Stif::PermissionTranslator do
).to match_array(Support::Permissions.all_permissions)
end
end
+
+ context "For the STIF organisation" do
+ let(:organisation){ build_stubbed :organisation, name: "STIF" }
+ let(:permissions){ %w{calendars.share stop_area_referentials.synchronize line_referentials.synchronize}.sort }
+ it "adds the STIF permission" do
+ expect(described_class.translate([], organisation).sort).to eq permissions
+ end
+
+ context "with the case changed" do
+ let(:organisation){ build_stubbed :organisation, name: "StiF" }
+ it "adds the STIF permission" do
+ expect(described_class.translate([], organisation).sort).to eq permissions
+ end
+ end
+ end
end