aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorXinhui2017-04-27 15:14:05 +0200
committerXinhui2017-04-27 15:14:16 +0200
commit5cf914aec14e39507a3d7c05834fbd945340be92 (patch)
tree9db472edccaa93035cc4feedd0d777cd2ab75ebd /spec
parentcaab8418c994194d52f2685514644cddd177083e (diff)
downloadchouette-core-5cf914aec14e39507a3d7c05834fbd945340be92.tar.bz2
Wip TimeTables#update save TimeTableDate
Refs #2899
Diffstat (limited to 'spec')
-rw-r--r--spec/models/chouette/time_table_spec.rb24
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