diff options
| author | Zog | 2018-02-02 17:54:07 +0100 |
|---|---|---|
| committer | Zog | 2018-02-02 17:54:07 +0100 |
| commit | 126879438a1109623a8445754e864c7082ba1649 (patch) | |
| tree | 5e1a30656af12115bb2797cd3df8f626052e0e81 /spec/models | |
| parent | 3f9329dffaf4a760adb128824b673c221c8320b8 (diff) | |
| download | chouette-core-5417-checksum-relationships.tar.bz2 | |
Refs #5417; Fix specs5417-checksum-relationships
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/chouette/time_table_spec.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb index 30e201c4d..a501f234a 100644 --- a/spec/models/chouette/time_table_spec.rb +++ b/spec/models/chouette/time_table_spec.rb @@ -1050,6 +1050,17 @@ end describe 'checksum' do it_behaves_like 'checksum support', :time_table + + it "handles newly built dates and periods" do + time_table = build(:time_table) + time_table.periods.build period_start: Time.now, period_end: 1.month.from_now + time_table.dates.build date: Time.now + time_table.save! + expect{time_table.update_checksum!}.to_not change{time_table.checksum} + expect(time_table.dates.count).to eq 1 + expect(time_table.periods.count).to eq 1 + end + it "changes when a date is updated" do time_table = create(:time_table) expect{time_table.dates.last.update_attribute(:date, Time.now)}.to change{time_table.reload.checksum} @@ -1058,7 +1069,7 @@ end it "changes when a date is added" do time_table = create(:time_table) expect(time_table).to receive(:update_checksum_without_callbacks!).at_least(:once).and_call_original - expect{create(:time_table_date, time_table: time_table)}.to change{time_table.checksum} + expect{create(:time_table_date, time_table: time_table, date: 1.year.ago)}.to change{time_table.checksum} end it "changes when a period is updated" do |
