diff options
| author | Xinhui | 2017-04-27 15:14:05 +0200 |
|---|---|---|
| committer | Xinhui | 2017-04-28 14:48:23 +0200 |
| commit | d370548b8653f4a24c75460ececa1468aaaf38b3 (patch) | |
| tree | 76d1b64d81e55ec0798b27c93146ac5e89275e5e /spec | |
| parent | 5c8db7c546224f6dd8e8aa07497adaaf48929221 (diff) | |
| download | chouette-core-d370548b8653f4a24c75460ececa1468aaaf38b3.tar.bz2 | |
Wip TimeTables#update save TimeTableDate
Refs #2899
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/chouette/time_table_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb index e45b3a205..1117eecc0 100644 --- a/spec/models/chouette/time_table_spec.rb +++ b/spec/models/chouette/time_table_spec.rb @@ -51,6 +51,30 @@ describe Chouette::TimeTable, :type => :model do subject.state_update state expect(subject.reload.excluded_days.count).to eq (updated.compact.count) end + + it 'should create new include date' do + day = state['current_month'].first + date = Date.parse(day['date']) + day['include_date'] = true + expect(subject.included_days).not_to include(date) + + expect { + subject.state_update state + }.to change {subject.dates.count}.by(1) + expect(subject.reload.included_days).to include(date) + end + + it 'should create new exclude date' do + day = state['current_month'].first + date = Date.parse(day['date']) + day['excluded_date'] = true + expect(subject.excluded_days).not_to include(date) + + expect { + subject.state_update state + }.to change {subject.dates.count}.by(1) + expect(subject.reload.excluded_days).to include(date) + end end describe "#periods_max_date" do |
