aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/models/chouette/area_type_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/chouette/area_type_spec.rb b/spec/models/chouette/area_type_spec.rb
new file mode 100644
index 000000000..6ae40ab1e
--- /dev/null
+++ b/spec/models/chouette/area_type_spec.rb
@@ -0,0 +1,28 @@
+require "rails_helper"
+
+RSpec.describe Chouette::AreaType do
+
+ describe "::ALL" do
+ it "include all supported types" do
+ expect(Chouette::AreaType::ALL).to eq %i(zdep zder zdlp zdlr lda)
+ end
+ end
+
+ describe ".find" do
+ it "returns nil if the given code is unknown" do
+ expect(Chouette::AreaType.find('dummy')).to be_nil
+ end
+
+ it "returns a AreaType associated to the code" do
+ expect(Chouette::AreaType.find('zdep').code).to eq :zdep
+ end
+ end
+
+ describe ".options" do
+ it "returns an array with label and code for each type" do
+ allow(Chouette::AreaType).to receive(:all).and_return(%i{zdep lda})
+ expect(Chouette::AreaType.options).to eq([["ZDEp", :zdep], ["LDA", :lda]])
+ end
+ end
+
+end