diff options
| author | Alban Peignier | 2017-12-18 16:58:19 +0100 |
|---|---|---|
| committer | Alban Peignier | 2017-12-18 16:58:19 +0100 |
| commit | 4f2a958ff7482fc0f259ff52c13b725181bd6ece (patch) | |
| tree | 74900b980645b5b1c57466a005c6fd1ee64d7205 | |
| parent | 0f5031e44fd3813d4565ebb8237d4cc623e04ce1 (diff) | |
| download | chouette-core-4f2a958ff7482fc0f259ff52c13b725181bd6ece.tar.bz2 | |
Add first specs on Chouette::AreaType. Refs #5311
| -rw-r--r-- | spec/models/chouette/area_type_spec.rb | 28 |
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 |
