diff options
| author | Alban Peignier | 2015-06-15 15:00:00 +0200 | 
|---|---|---|
| committer | Alban Peignier | 2015-06-15 15:00:15 +0200 | 
| commit | cb9b401df1cffdb4411378e13fb65174b6991c31 (patch) | |
| tree | 5003eba0fbe5271db095282d44bc681e098b44f3 /spec | |
| parent | 275b1893722ec09bc04033344865bea399eb9ca3 (diff) | |
| download | chouette-core-cb9b401df1cffdb4411378e13fb65174b6991c31.tar.bz2 | |
Manage optional attributes in ExportTask. Hide these fields in form. Refs #36455
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/export_task_spec.rb | 8 | ||||
| -rw-r--r-- | spec/models/gtfs_export_spec.rb | 39 | 
2 files changed, 39 insertions, 8 deletions
diff --git a/spec/models/export_task_spec.rb b/spec/models/export_task_spec.rb new file mode 100644 index 000000000..1a52a6175 --- /dev/null +++ b/spec/models/export_task_spec.rb @@ -0,0 +1,8 @@ +require 'spec_helper' + +describe ExportTask, :type => :model do + +  it { should_not validate_presence_of(:start_date) } +  it { should_not validate_presence_of(:end_date) } + +end diff --git a/spec/models/gtfs_export_spec.rb b/spec/models/gtfs_export_spec.rb index a5e5d0335..6051497a7 100644 --- a/spec/models/gtfs_export_spec.rb +++ b/spec/models/gtfs_export_spec.rb @@ -1,10 +1,33 @@ -# require 'spec_helper' +require 'spec_helper' -# describe GtfsExport, :type => :model do +describe GtfsExport, :type => :model do -#   describe '#export_options' do -#     subject { super().export_options } -#     it { is_expected.to include(:format => :gtfs) } -#   end -   -# end +  describe "#time_zone" do + +    context "when exported data are not StopAreas" do + +      before do +        subject.references_type = "network" +      end + +      it "should be mandatory" do +        subject.should validate_presence_of(:time_zone) +      end + +    end + +    context "when export data are StopArea" do + +      before do +        subject.references_type = "stop_area" +      end + +      it "should be mandatory" do +        subject.should_not validate_presence_of(:time_zone) +      end + +    end + +  end + +end  | 
