|
118 | 118 | expect(notify_log_entry.sent_by).to eq(sent_by) |
119 | 119 | end |
120 | 120 |
|
121 | | - it "creates a log entry programme record" do |
122 | | - expect { perform_now }.to change(NotifyLogEntry::Programme, :count).by(1) |
| 121 | + context "with a non-MMR programme" do |
| 122 | + let(:programmes) { [Programme.find("flu")] } |
123 | 123 |
|
124 | | - notify_log_entry_programme = NotifyLogEntry::Programme.last |
| 124 | + it "creates a log entry programme record" do |
| 125 | + expect { perform_now }.to change(NotifyLogEntry::Programme, :count).by( |
| 126 | + 1 |
| 127 | + ) |
125 | 128 |
|
126 | | - expect(notify_log_entry_programme.programme_type).to eq( |
127 | | - programmes.first.type |
128 | | - ) |
| 129 | + notify_log_entry_programme = |
| 130 | + NotifyLogEntry.last.notify_log_entry_programmes.first |
129 | 131 |
|
130 | | - disease_types = |
131 | | - if programmes.first.mmr? |
132 | | - Programme::Variant::DISEASE_TYPES.fetch("mmr") |
133 | | - else |
134 | | - programmes.first.disease_types |
135 | | - end |
| 132 | + expect(notify_log_entry_programme.programme_type).to eq("flu") |
| 133 | + expect(notify_log_entry_programme.disease_types).to eq(%w[influenza]) |
| 134 | + end |
| 135 | + end |
| 136 | + |
| 137 | + context "with an MMR programme and disease types" do |
| 138 | + let(:programmes) { [Programme.find("mmr")] } |
| 139 | + let(:disease_types) { %w[measles mumps rubella] } |
136 | 140 |
|
137 | | - expect(notify_log_entry_programme.disease_types).to eq(disease_types) |
| 141 | + it "creates a log entry programme record with variant disease types" do |
| 142 | + expect { perform_now }.to change(NotifyLogEntry::Programme, :count).by( |
| 143 | + 1 |
| 144 | + ) |
| 145 | + |
| 146 | + notify_log_entry_programme = |
| 147 | + NotifyLogEntry.last.notify_log_entry_programmes.first |
| 148 | + |
| 149 | + expect(notify_log_entry_programme.programme_type).to eq("mmr") |
| 150 | + expect(notify_log_entry_programme.disease_types).to eq( |
| 151 | + %w[measles mumps rubella] |
| 152 | + ) |
| 153 | + end |
138 | 154 | end |
139 | 155 |
|
140 | 156 | context "when the parent doesn't have an email address" do |
|
0 commit comments