aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/stif
diff options
context:
space:
mode:
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