aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorAlban Peignier2018-02-22 10:58:12 +0100
committerGitHub2018-02-22 10:58:12 +0100
commit1e137b3347660e8cea9d5c154111ef368fc60609 (patch)
treefb4ab90057fb67d3894f8773ce4ced59b67dceae /spec
parentb5db0e9477f22e0d2acdd40c5db710f16d517a10 (diff)
parent8aab474b8ad555b4d5f8e28c0af2f6c72741e317 (diff)
downloadchouette-core-1e137b3347660e8cea9d5c154111ef368fc60609.tar.bz2
Merge pull request #319 from af83/5609_slug_format
Avoid problem with numeric in slug. Refs #5609
Diffstat (limited to 'spec')
-rw-r--r--spec/models/referential_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb
index 6d699f759..2d4649b87 100644
--- a/spec/models/referential_spec.rb
+++ b/spec/models/referential_spec.rb
@@ -9,6 +9,24 @@ describe Referential, :type => :model do
subject { build_stubbed(:referential) }
it { should validate_presence_of(:objectid_format) }
+
+ it "assign slug with a good format" do
+ time_reference = double(now: 1234567890)
+
+ conditions = {
+ "2018-Hiver-Jezequel-MM-Lyon-Nice": "hiver_jezequel_mm_lyon_nice_1234567890",
+ "2018-Hiver-Jezequel-23293MM-Lyon-Nice": "hiver_jezequel_mm_lyon_nice_1234567890",
+ "-Hiver-Jezequel-MM-Lyon-Nice": "hiver_jezequel_mm_lyon_nice_1234567890",
+ "Hiver-Jezequel-MM-Lyon-Nice": "hiver_jezequel_mm_lyon_nice_1234567890",
+ "20179282": "referential_1234567890"
+ }
+
+ conditions.each do |name, expected_slug|
+ ref = Referential.new name: name
+ ref.assign_slug time_reference
+ expect(ref.slug).to eq(expected_slug)
+ end
+ end
end
context ".referential_ids_in_periode" do